diff options
author | Dave Young <hidave.darkstar@gmail.com> | 2009-05-11 02:18:55 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-06-16 00:30:24 -0400 |
commit | 9227c47bbdd87f276e08ed17877cc1649f5ed10a (patch) | |
tree | af576b46ed9825573a11321db63c4038b4abcd9f /drivers/base/sys.c | |
parent | d9cd8f37855b012757818f31390e8f84db251c89 (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>
Diffstat (limited to 'drivers/base/sys.c')
-rw-r--r-- | drivers/base/sys.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/base/sys.c b/drivers/base/sys.c index 9742a78c9fe4..162355cd745a 100644 --- a/drivers/base/sys.c +++ b/drivers/base/sys.c | |||
@@ -131,6 +131,8 @@ static struct kset *system_kset; | |||
131 | 131 | ||
132 | int sysdev_class_register(struct sysdev_class *cls) | 132 | int sysdev_class_register(struct sysdev_class *cls) |
133 | { | 133 | { |
134 | int retval; | ||
135 | |||
134 | pr_debug("Registering sysdev class '%s'\n", cls->name); | 136 | pr_debug("Registering sysdev class '%s'\n", cls->name); |
135 | 137 | ||
136 | INIT_LIST_HEAD(&cls->drivers); | 138 | INIT_LIST_HEAD(&cls->drivers); |
@@ -138,7 +140,11 @@ int sysdev_class_register(struct sysdev_class *cls) | |||
138 | cls->kset.kobj.parent = &system_kset->kobj; | 140 | cls->kset.kobj.parent = &system_kset->kobj; |
139 | cls->kset.kobj.ktype = &ktype_sysdev_class; | 141 | cls->kset.kobj.ktype = &ktype_sysdev_class; |
140 | cls->kset.kobj.kset = system_kset; | 142 | cls->kset.kobj.kset = system_kset; |
141 | kobject_set_name(&cls->kset.kobj, cls->name); | 143 | |
144 | retval = kobject_set_name(&cls->kset.kobj, cls->name); | ||
145 | if (retval) | ||
146 | return retval; | ||
147 | |||
142 | return kset_register(&cls->kset); | 148 | return kset_register(&cls->kset); |
143 | } | 149 | } |
144 | 150 | ||