]> www.infradead.org Git - users/mchehab/edac.git/commitdiff
edac_mc: check for allocation failure in edac_mc_alloc() hw_events_v26
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 18 May 2012 12:51:02 +0000 (15:51 +0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 18 May 2012 15:21:21 +0000 (12:21 -0300)
Add a check here for if kzalloc() failed.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/edac/edac_mc.c

index 0dfda4cdbe4d67eccb054d5a99b790ee29eeac24..42937ae3986bc648dbad62fa6826dc8120733aa8 100644 (file)
@@ -354,6 +354,8 @@ struct mem_ctl_info *edac_mc_alloc(unsigned mc_num,
                }
 
                dimm = kzalloc(sizeof(**mci->dimms), GFP_KERNEL);
+               if (!dimm)
+                       goto error;
                mci->dimms[off] = dimm;
                dimm->mci = mci;