edac_mc: check for allocation failure in edac_mc_alloc()
Dan Carpenter [Fri, 18 May 2012 12:51:02 +0000 (15:51 +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 98c759d..91ca410 100644 (file)
@@ -355,6 +355,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;