From: Akinobu Mita <akinobu.mita@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: akpm@osdl.org, Doug Thompson <norsk5@xmission.com>
Subject: [PATCH] edac_mc: fix error handling
Date: Tue, 24 Oct 2006 17:55:20 +0900 [thread overview]
Message-ID: <20061024085520.GC7703@localhost> (raw)
Call sysdev_class_unregister() on failure in edac_sysfs_memctrl_setup()
and decrease identation level for clear logic.
Cc: Doug Thompson <norsk5@xmission.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
drivers/edac/edac_mc.c | 49 +++++++++++++++++++++++++++++--------------------
1 file changed, 29 insertions(+), 20 deletions(-)
Index: work-fault-inject/drivers/edac/edac_mc.c
===================================================================
--- work-fault-inject.orig/drivers/edac/edac_mc.c
+++ work-fault-inject/drivers/edac/edac_mc.c
@@ -230,34 +230,43 @@ static struct kobj_type ktype_memctrl =
*/
static int edac_sysfs_memctrl_setup(void)
{
- int err=0;
+ int err = 0;
debugf1("%s()\n", __func__);
/* create the /sys/devices/system/edac directory */
err = sysdev_class_register(&edac_class);
- if (!err) {
- /* Init the MC's kobject */
- memset(&edac_memctrl_kobj, 0, sizeof (edac_memctrl_kobj));
- edac_memctrl_kobj.parent = &edac_class.kset.kobj;
- edac_memctrl_kobj.ktype = &ktype_memctrl;
-
- /* generate sysfs "..../edac/mc" */
- err = kobject_set_name(&edac_memctrl_kobj,"mc");
-
- if (!err) {
- /* FIXME: maybe new sysdev_create_subdir() */
- err = kobject_register(&edac_memctrl_kobj);
-
- if (err)
- debugf1("Failed to register '.../edac/mc'\n");
- else
- debugf1("Registered '.../edac/mc' kobject\n");
- }
- } else
+ if (err) {
debugf1("%s() error=%d\n", __func__, err);
+ return err;
+ }
+
+ /* Init the MC's kobject */
+ memset(&edac_memctrl_kobj, 0, sizeof (edac_memctrl_kobj));
+ edac_memctrl_kobj.parent = &edac_class.kset.kobj;
+ edac_memctrl_kobj.ktype = &ktype_memctrl;
+
+ /* generate sysfs "..../edac/mc" */
+ err = kobject_set_name(&edac_memctrl_kobj,"mc");
+ if (err)
+ goto fail;
+
+ /* FIXME: maybe new sysdev_create_subdir() */
+ err = kobject_register(&edac_memctrl_kobj);
+
+ if (err) {
+ debugf1("Failed to register '.../edac/mc'\n");
+ goto fail;
+ }
+
+ debugf1("Registered '.../edac/mc' kobject\n");
+
+ return 0;
+
+fail:
+ sysdev_class_unregister(&edac_class);
return err;
}
reply other threads:[~2006-10-24 8:55 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=20061024085520.GC7703@localhost \
--to=akinobu.mita@gmail.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=norsk5@xmission.com \
/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