EDAC: i7core: Return proper error codes for kzalloc() errors
authorTakashi Iwai <tiwai@suse.de>
Wed, 4 Feb 2015 10:48:54 +0000 (11:48 +0100)
committerBorislav Petkov <bp@suse.de>
Mon, 23 Feb 2015 12:08:45 +0000 (13:08 +0100)
... instead of possibly uninitialized return value.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: http://lkml.kernel.org/r/1423046938-18111-5-git-send-email-tiwai@suse.de
[ Add a commit message, albeit a small one. ]
Signed-off-by: Borislav Petkov <bp@suse.de>
drivers/edac/i7core_edac.c

index 9cd0b301f81ba5a5a3fb52dfcc87ef337d7bcb41..5da90ded54b61fe352773acbb858e9b3fc107d4e 100644 (file)
@@ -1177,7 +1177,7 @@ static int i7core_create_sysfs_devices(struct mem_ctl_info *mci)
 
        pvt->addrmatch_dev = kzalloc(sizeof(*pvt->addrmatch_dev), GFP_KERNEL);
        if (!pvt->addrmatch_dev)
-               return rc;
+               return -ENOMEM;
 
        pvt->addrmatch_dev->type = &addrmatch_type;
        pvt->addrmatch_dev->bus = mci->dev.bus;
@@ -1198,7 +1198,7 @@ static int i7core_create_sysfs_devices(struct mem_ctl_info *mci)
                if (!pvt->chancounts_dev) {
                        put_device(pvt->addrmatch_dev);
                        device_del(pvt->addrmatch_dev);
-                       return rc;
+                       return -ENOMEM;
                }
 
                pvt->chancounts_dev->type = &all_channel_counts_type;