mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dave Peterson <dsp@llnl.gov>
To: alan@lxorguk.ukuu.org.uk, akpm@osdl.org
Cc: linux-kernel@vger.kernel.org, bluesmoke-devel@lists.sourceforge.net
Subject: [PATCH 11/15] EDAC: edac_mc_add_mc() fix [2/2]
Date: Thu, 2 Mar 2006 17:48:09 -0800	[thread overview]
Message-ID: <200603021748.09413.dsp@llnl.gov> (raw)

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> <dave_peterson@pobox.com>
---

Index: linux-2.6.16-rc5-edac/drivers/edac/edac_mc.c
===================================================================
--- linux-2.6.16-rc5-edac.orig/drivers/edac/edac_mc.c	2006-02-27 17:06:17.000000000 -0800
+++ linux-2.6.16-rc5-edac/drivers/edac/edac_mc.c	2006-02-27 17:06:37.000000000 -0800
@@ -1438,8 +1438,6 @@ EXPORT_SYMBOL(edac_mc_add_mc);
 /* FIXME - should a warning be printed if no error detection? correction? */
 int edac_mc_add_mc(struct mem_ctl_info *mci)
 {
-	int rc = 1;
-
 	debugf0("%s()\n", __func__);
 #ifdef CONFIG_EDAC_DEBUG
 	if (edac_debug_level >= 3)
@@ -1459,7 +1457,7 @@ int edac_mc_add_mc(struct mem_ctl_info *
 	down(&mem_ctls_mutex);
 
 	if (add_mc_to_global_list(mci))
-		goto finish;
+		goto fail0;
 
 	/* set load time so that error rate can be tracked */
 	mci->start_time = jiffies;
@@ -1467,20 +1465,22 @@ int edac_mc_add_mc(struct mem_ctl_info *
         if (edac_create_sysfs_mci_device(mci)) {
                 edac_mc_printk(mci, KERN_WARNING,
 			       "failed to create sysfs device\n");
-		/* FIXME - should there be an error code and unwind? */
-                goto finish;
+                goto fail1;
         }
 
 	/* Report action taken */
 	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));
 
+	up(&mem_ctls_mutex);
+	return 0;
 
-	rc = 0;
+fail1:
+	del_mc_from_global_list(mci);
 
-finish:
+fail0:
 	up(&mem_ctls_mutex);
-	return rc;
+	return 1;
 }
 
 

                 reply	other threads:[~2006-03-03  1:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200603021748.09413.dsp@llnl.gov \
    --to=dsp@llnl.gov \
    --cc=akpm@osdl.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=bluesmoke-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome