[PATCH 3/3] driver-core : make sysdev_class_register check kobject_set_name return value

From: Dave Young
Date: Mon May 11 2009 - 02:19:12 EST


sysdev_class_register should check the kobject_set_name return value.

Add the return value checking code.

Signed-off-by: Dave Young <hidave.darkstar@xxxxxxxxx>
---
drivers/base/sys.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff -uprN linux.old/drivers/base/sys.c linux.new/drivers/base/sys.c
--- linux.old/drivers/base/sys.c 2009-05-11 13:59:16.000000000 +0800
+++ linux.new/drivers/base/sys.c 2009-05-11 14:01:16.000000000 +0800
@@ -131,6 +131,8 @@ static struct kset *system_kset;

int sysdev_class_register(struct sysdev_class *cls)
{
+ int retval;
+
pr_debug("Registering sysdev class '%s'\n", cls->name);

INIT_LIST_HEAD(&cls->drivers);
@@ -138,7 +140,11 @@ int sysdev_class_register(struct sysdev_
cls->kset.kobj.parent = &system_kset->kobj;
cls->kset.kobj.ktype = &ktype_sysdev_class;
cls->kset.kobj.kset = system_kset;
- kobject_set_name(&cls->kset.kobj, cls->name);
+
+ retval = kobject_set_name(&cls->kset.kobj, cls->name);
+ if (retval)
+ return retval;
+
return kset_register(&cls->kset);
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/