aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac/edac_mc.c
diff options
context:
space:
mode:
authorDave Peterson <dsp@llnl.gov>2006-03-26 04:38:47 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-26 11:57:07 -0500
commit028a7b6d3d9fa2cc41d76d45575345cca8d00a4c (patch)
tree42d59be8db8af1cd60e8388c2d93230335b28606 /drivers/edac/edac_mc.c
parenta1d03fcc1399b1e23922bcc3af1772b128aa6e93 (diff)
[PATCH] EDAC: edac_mc_add_mc fix [2/2]
This is part 2 of a 2-part patch set. Fix edac_mc_add_mc() so it cleans up properly if call to edac_create_sysfs_mci_device() fails. Signed-off-by: David S. Peterson <dsp@llnl.gov> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/edac/edac_mc.c')
-rw-r--r--drivers/edac/edac_mc.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c
index 226d4fdb15fd..d37a4c4a3125 100644
--- a/drivers/edac/edac_mc.c
+++ b/drivers/edac/edac_mc.c
@@ -1484,8 +1484,6 @@ EXPORT_SYMBOL(edac_mc_add_mc);
1484/* FIXME - should a warning be printed if no error detection? correction? */ 1484/* FIXME - should a warning be printed if no error detection? correction? */
1485int edac_mc_add_mc(struct mem_ctl_info *mci) 1485int edac_mc_add_mc(struct mem_ctl_info *mci)
1486{ 1486{
1487 int rc = 1;
1488
1489 debugf0("%s()\n", __func__); 1487 debugf0("%s()\n", __func__);
1490#ifdef CONFIG_EDAC_DEBUG 1488#ifdef CONFIG_EDAC_DEBUG
1491 if (edac_debug_level >= 3) 1489 if (edac_debug_level >= 3)
@@ -1505,7 +1503,7 @@ int edac_mc_add_mc(struct mem_ctl_info *mci)
1505 down(&mem_ctls_mutex); 1503 down(&mem_ctls_mutex);
1506 1504
1507 if (add_mc_to_global_list(mci)) 1505 if (add_mc_to_global_list(mci))
1508 goto finish; 1506 goto fail0;
1509 1507
1510 /* set load time so that error rate can be tracked */ 1508 /* set load time so that error rate can be tracked */
1511 mci->start_time = jiffies; 1509 mci->start_time = jiffies;
@@ -1513,19 +1511,22 @@ int edac_mc_add_mc(struct mem_ctl_info *mci)
1513 if (edac_create_sysfs_mci_device(mci)) { 1511 if (edac_create_sysfs_mci_device(mci)) {
1514 edac_mc_printk(mci, KERN_WARNING, 1512 edac_mc_printk(mci, KERN_WARNING,
1515 "failed to create sysfs device\n"); 1513 "failed to create sysfs device\n");
1516 /* FIXME - should there be an error code and unwind? */ 1514 goto fail1;
1517 goto finish;
1518 } 1515 }
1519 1516
1520 /* Report action taken */ 1517 /* Report action taken */
1521 edac_mc_printk(mci, KERN_INFO, "Giving out device to %s %s: PCI %s\n", 1518 edac_mc_printk(mci, KERN_INFO, "Giving out device to %s %s: PCI %s\n",
1522 mci->mod_name, mci->ctl_name, pci_name(mci->pdev)); 1519 mci->mod_name, mci->ctl_name, pci_name(mci->pdev));
1523 1520
1524 rc = 0; 1521 up(&mem_ctls_mutex);
1522 return 0;
1525 1523
1526finish: 1524fail1:
1525 del_mc_from_global_list(mci);
1526
1527fail0:
1527 up(&mem_ctls_mutex); 1528 up(&mem_ctls_mutex);
1528 return rc; 1529 return 1;
1529} 1530}
1530 1531
1531 1532