summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Young <hidave.darkstar@gmail.com>2009-05-11 14:18:55 +0800
committerGreg Kroah-Hartman <gregkh@suse.de>2009-06-15 21:30:24 -0700
commit9227c47bbdd87f276e08ed17877cc1649f5ed10a (patch)
treeaf576b46ed9825573a11321db63c4038b4abcd9f
parentd9cd8f37855b012757818f31390e8f84db251c89 (diff)
driver-core: make sysdev_class_register check kobject_set_name return value
sysdev_class_register should check the kobject_set_name return value. Add the return value checking code. Signed-off-by: Dave Young <hidave.darkstar@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/base/sys.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/base/sys.c b/drivers/base/sys.c
index 9742a78c9fe..162355cd745 100644
--- a/drivers/base/sys.c
+++ b/drivers/base/sys.c
@@ -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_class *cls)
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);
}