Commit 9227c47b authored by Dave Young's avatar Dave Young Committed by Greg Kroah-Hartman

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: default avatarDave Young <hidave.darkstar@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent d9cd8f37
...@@ -131,6 +131,8 @@ static struct kset *system_kset; ...@@ -131,6 +131,8 @@ static struct kset *system_kset;
int sysdev_class_register(struct sysdev_class *cls) int sysdev_class_register(struct sysdev_class *cls)
{ {
int retval;
pr_debug("Registering sysdev class '%s'\n", cls->name); pr_debug("Registering sysdev class '%s'\n", cls->name);
INIT_LIST_HEAD(&cls->drivers); INIT_LIST_HEAD(&cls->drivers);
...@@ -138,7 +140,11 @@ int sysdev_class_register(struct sysdev_class *cls) ...@@ -138,7 +140,11 @@ int sysdev_class_register(struct sysdev_class *cls)
cls->kset.kobj.parent = &system_kset->kobj; cls->kset.kobj.parent = &system_kset->kobj;
cls->kset.kobj.ktype = &ktype_sysdev_class; cls->kset.kobj.ktype = &ktype_sysdev_class;
cls->kset.kobj.kset = system_kset; 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); return kset_register(&cls->kset);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment