summaryrefslogtreecommitdiff
path: root/drivers/edac
diff options
context:
space:
mode:
authorHidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>2010-08-20 04:28:40 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-10-24 11:20:40 -0200
commit628c5ddfb08094a5ef9186dc866d09bfcac105c9 (patch)
tree49bd3550e4d8e89bcf3ffe70b1a53b283f439bd7 /drivers/edac
parent5939813b9c4270d0f46375c3cad64226bb1fcd62 (diff)
downloadlwn-628c5ddfb08094a5ef9186dc866d09bfcac105c9.tar.gz
lwn-628c5ddfb08094a5ef9186dc866d09bfcac105c9.zip
i7core_edac: Fix error path of i7core_register_mci
Release resources properly. Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/edac')
-rw-r--r--drivers/edac/i7core_edac.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c
index 6bebf4d73f48..3542e8c0a63f 100644
--- a/drivers/edac/i7core_edac.c
+++ b/drivers/edac/i7core_edac.c
@@ -1954,7 +1954,7 @@ static int i7core_register_mci(struct i7core_dev *i7core_dev,
/* Store pci devices at mci for faster access */
rc = mci_bind_devs(mci, i7core_dev);
if (unlikely(rc < 0))
- goto fail;
+ goto fail0;
if (pvt->is_registered)
mci->mc_driver_sysfs_attributes = i7core_sysfs_rdimm_attrs;
@@ -1977,7 +1977,7 @@ static int i7core_register_mci(struct i7core_dev *i7core_dev,
*/
rc = -EINVAL;
- goto fail;
+ goto fail0;
}
/* Default error mask is any memory */
@@ -1998,11 +1998,17 @@ static int i7core_register_mci(struct i7core_dev *i7core_dev,
if (unlikely(rc < 0)) {
debugf0("MC: " __FILE__
": %s(): failed edac_mce_register()\n", __func__);
+ goto fail1;
}
-fail:
- if (rc < 0)
- edac_mc_free(mci);
+ return 0;
+
+fail1:
+ i7core_pci_ctl_release(pvt);
+ edac_mc_del_mc(mci->dev);
+fail0:
+ kfree(mci->ctl_name);
+ edac_mc_free(mci);
return rc;
}