Re: [patch] fix broken topology functions

From: William Lee Irwin III (wli@holomorphy.com)
Date: Wed Dec 04 2002 - 19:20:23 EST


On Wed, Dec 04, 2002 at 03:54:07PM -0800, Matthew Dobson wrote:
> Linus,
> The register_(node|memblk)_driver functions are broken. Pat Mochel
> recently updated sysfs to make sure that when you register a driver that
> it's associated devclass is already registered. The way node/memblk
> registration is done now is backwards and causes panic's on NUMA
> systems. Please apply this patch to fix it.
> Cheers!

That didn't check the return value of devclass_register():

Reorder devclass_register() and driver_register() so these things
stop oopsing.

 memblk.c | 4 ++--
 node.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff -urpN mm1-2.5.50/drivers/base/memblk.c mm1-2.5.50-1/drivers/base/memblk.c
--- mm1-2.5.50/drivers/base/memblk.c 2002-11-27 14:36:23.000000000 -0800
+++ mm1-2.5.50-1/drivers/base/memblk.c 2002-12-04 12:53:59.000000000 -0800
@@ -49,7 +49,7 @@ int __init register_memblk(struct memblk
 
 static int __init register_memblk_type(void)
 {
- driver_register(&memblk_driver);
- return devclass_register(&memblk_devclass);
+ int error = devclass_register(&memblk_devclass);
+ return error ? error : driver_register(&memblk_driver);
 }
 postcore_initcall(register_memblk_type);
diff -urpN mm1-2.5.50/drivers/base/node.c mm1-2.5.50-1/drivers/base/node.c
--- mm1-2.5.50/drivers/base/node.c 2002-11-27 14:35:50.000000000 -0800
+++ mm1-2.5.50-1/drivers/base/node.c 2002-12-04 12:53:05.000000000 -0800
@@ -93,7 +93,7 @@ int __init register_node(struct node *no
 
 static int __init register_node_type(void)
 {
- driver_register(&node_driver);
- return devclass_register(&node_devclass);
+ int error = devclass_register(&node_devclass);
+ return error ? error : driver_register(&node_driver);
 }
 postcore_initcall(register_node_type);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Dec 07 2002 - 22:00:20 EST