mirror of
https://github.com/fail0verflow/switch-linux.git
synced 2025-05-04 02:34:21 -04:00
[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>
This commit is contained in:
parent
a1d03fcc13
commit
028a7b6d3d
1 changed files with 10 additions and 9 deletions
|
@ -1484,8 +1484,6 @@ EXPORT_SYMBOL(edac_mc_add_mc);
|
||||||
/* FIXME - should a warning be printed if no error detection? correction? */
|
/* FIXME - should a warning be printed if no error detection? correction? */
|
||||||
int edac_mc_add_mc(struct mem_ctl_info *mci)
|
int edac_mc_add_mc(struct mem_ctl_info *mci)
|
||||||
{
|
{
|
||||||
int rc = 1;
|
|
||||||
|
|
||||||
debugf0("%s()\n", __func__);
|
debugf0("%s()\n", __func__);
|
||||||
#ifdef CONFIG_EDAC_DEBUG
|
#ifdef CONFIG_EDAC_DEBUG
|
||||||
if (edac_debug_level >= 3)
|
if (edac_debug_level >= 3)
|
||||||
|
@ -1505,7 +1503,7 @@ int edac_mc_add_mc(struct mem_ctl_info *mci)
|
||||||
down(&mem_ctls_mutex);
|
down(&mem_ctls_mutex);
|
||||||
|
|
||||||
if (add_mc_to_global_list(mci))
|
if (add_mc_to_global_list(mci))
|
||||||
goto finish;
|
goto fail0;
|
||||||
|
|
||||||
/* set load time so that error rate can be tracked */
|
/* set load time so that error rate can be tracked */
|
||||||
mci->start_time = jiffies;
|
mci->start_time = jiffies;
|
||||||
|
@ -1513,19 +1511,22 @@ int edac_mc_add_mc(struct mem_ctl_info *mci)
|
||||||
if (edac_create_sysfs_mci_device(mci)) {
|
if (edac_create_sysfs_mci_device(mci)) {
|
||||||
edac_mc_printk(mci, KERN_WARNING,
|
edac_mc_printk(mci, KERN_WARNING,
|
||||||
"failed to create sysfs device\n");
|
"failed to create sysfs device\n");
|
||||||
/* FIXME - should there be an error code and unwind? */
|
goto fail1;
|
||||||
goto finish;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Report action taken */
|
/* Report action taken */
|
||||||
edac_mc_printk(mci, KERN_INFO, "Giving out device to %s %s: PCI %s\n",
|
edac_mc_printk(mci, KERN_INFO, "Giving out device to %s %s: PCI %s\n",
|
||||||
mci->mod_name, mci->ctl_name, pci_name(mci->pdev));
|
mci->mod_name, mci->ctl_name, pci_name(mci->pdev));
|
||||||
|
|
||||||
rc = 0;
|
|
||||||
|
|
||||||
finish:
|
|
||||||
up(&mem_ctls_mutex);
|
up(&mem_ctls_mutex);
|
||||||
return rc;
|
return 0;
|
||||||
|
|
||||||
|
fail1:
|
||||||
|
del_mc_from_global_list(mci);
|
||||||
|
|
||||||
|
fail0:
|
||||||
|
up(&mem_ctls_mutex);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue