From: Matthew Dobson <colpatch@us.ibm.com>
To: Trivial Patch Monkey <trivial@rustcorp.com.au>,
"Martin J. Bligh" <mbligh@aracnet.com>,
linux-kernel@vger.kernel.org, Patrick Mochel <mochel@osdl.org>
Subject: [patch] Fix error handling in sysfs registration
Date: Mon, 17 Mar 2003 17:45:26 -0800 [thread overview]
Message-ID: <3E767A36.5020300@us.ibm.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 295 bytes --]
The cpu, memblk, and node driver/device registration should be a little
more clean in the way it handles registration failures. Or at least
*consistent* amongst the topology elements. Right now, failures are
either silent, obscure, or leave things in an inconsistent state.
Cheers!
-Matt
[-- Attachment #2: sysfs_topo_cleanup-2.5.65.patch --]
[-- Type: text/plain, Size: 2003 bytes --]
diff -Nur --exclude-from=/usr/src/.dontdiff linux-2.5.64-vanilla/drivers/base/cpu.c linux-2.5.64-sysfs_cleanup/drivers/base/cpu.c
--- linux-2.5.64-vanilla/drivers/base/cpu.c Tue Mar 4 19:29:15 2003
+++ linux-2.5.64-sysfs_cleanup/drivers/base/cpu.c Mon Mar 17 14:08:59 2003
@@ -48,6 +48,9 @@
int __init cpu_dev_init(void)
{
- devclass_register(&cpu_devclass);
- return driver_register(&cpu_driver);
+ int error;
+ if (!(error = devclass_register(&cpu_devclass)))
+ if (error = driver_register(&cpu_driver))
+ devclass_unregister(&cpu_devclass);
+ return error;
}
diff -Nur --exclude-from=/usr/src/.dontdiff linux-2.5.64-vanilla/drivers/base/memblk.c linux-2.5.64-sysfs_cleanup/drivers/base/memblk.c
--- linux-2.5.64-vanilla/drivers/base/memblk.c Tue Mar 4 19:29:54 2003
+++ linux-2.5.64-sysfs_cleanup/drivers/base/memblk.c Mon Mar 17 14:09:42 2003
@@ -47,9 +47,12 @@
}
-static int __init register_memblk_type(void)
+int __init register_memblk_type(void)
{
- int error = devclass_register(&memblk_devclass);
- return error ? error : driver_register(&memblk_driver);
+ int error;
+ if (!(error = devclass_register(&memblk_devclass)))
+ if (error = driver_register(&memblk_driver))
+ devclass_unregister(&memblk_devclass);
+ return error;
}
postcore_initcall(register_memblk_type);
diff -Nur --exclude-from=/usr/src/.dontdiff linux-2.5.64-vanilla/drivers/base/node.c linux-2.5.64-sysfs_cleanup/drivers/base/node.c
--- linux-2.5.64-vanilla/drivers/base/node.c Tue Mar 4 19:29:00 2003
+++ linux-2.5.64-sysfs_cleanup/drivers/base/node.c Mon Mar 17 14:09:52 2003
@@ -89,9 +89,12 @@
}
-static int __init register_node_type(void)
+int __init register_node_type(void)
{
- int error = devclass_register(&node_devclass);
- return error ? error : driver_register(&node_driver);
+ int error;
+ if (!(error = devclass_register(&node_devclass)))
+ if (error = driver_register(&node_driver))
+ devclass_unregister(&node_devclass);
+ return error;
}
postcore_initcall(register_node_type);
next reply other threads:[~2003-03-18 1:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-03-18 1:45 Matthew Dobson [this message]
2003-03-25 21:11 ` [patch] Fix error handling in sysfs registration Patrick Mochel
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=3E767A36.5020300@us.ibm.com \
--to=colpatch@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mbligh@aracnet.com \
--cc=mochel@osdl.org \
--cc=trivial@rustcorp.com.au \
/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