* [patch] Fix error handling in sysfs registration
@ 2003-03-18 1:45 Matthew Dobson
2003-03-25 21:11 ` Patrick Mochel
0 siblings, 1 reply; 2+ messages in thread
From: Matthew Dobson @ 2003-03-18 1:45 UTC (permalink / raw)
To: Trivial Patch Monkey, Martin J. Bligh, linux-kernel,
Patrick Mochel
[-- 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);
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [patch] Fix error handling in sysfs registration
2003-03-18 1:45 [patch] Fix error handling in sysfs registration Matthew Dobson
@ 2003-03-25 21:11 ` Patrick Mochel
0 siblings, 0 replies; 2+ messages in thread
From: Patrick Mochel @ 2003-03-25 21:11 UTC (permalink / raw)
To: Matthew Dobson; +Cc: Trivial Patch Monkey, Martin J. Bligh, linux-kernel
Sorry about the delay, I've been traveling..
> 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.
Thanks. I've applied this, and will make sure it gets merged (finally).
-pat
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-03-25 21:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-18 1:45 [patch] Fix error handling in sysfs registration Matthew Dobson
2003-03-25 21:11 ` Patrick Mochel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox