ChangeSet 1.1608.84.8, 2004/03/11 10:57:27-08:00, ogasawara@osdl.org [PATCH] Fix class_register() always returns 0 I noticed that the class_register() function in drivers/base/class.c always returns 0 and thus will never fail. Patch below inserts simple error checking to return any errors if they occur. Feedback welcome. Thanks, drivers/base/class.c | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff -Nru a/drivers/base/class.c b/drivers/base/class.c --- a/drivers/base/class.c Mon Mar 15 15:29:19 2004 +++ b/drivers/base/class.c Mon Mar 15 15:29:19 2004 @@ -102,13 +102,21 @@ int class_register(struct class * cls) { + int error; + pr_debug("device class '%s': registering\n",cls->name); INIT_LIST_HEAD(&cls->children); INIT_LIST_HEAD(&cls->interfaces); - kobject_set_name(&cls->subsys.kset.kobj,cls->name); + error = kobject_set_name(&cls->subsys.kset.kobj,cls->name); + if (error) + return error; + subsys_set_kset(cls,class_subsys); - subsystem_register(&cls->subsys); + + error = subsystem_register(&cls->subsys); + if (error) + return error; return 0; }