mirror of
https://github.com/adulau/aha.git
synced 2024-12-27 03:06:10 +00:00
kobject: make kset_create check kobject_set_name return value
kset_create 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>
This commit is contained in:
parent
59a3cd7f9d
commit
d9cd8f3785
1 changed files with 6 additions and 1 deletions
|
@ -793,11 +793,16 @@ static struct kset *kset_create(const char *name,
|
||||||
struct kobject *parent_kobj)
|
struct kobject *parent_kobj)
|
||||||
{
|
{
|
||||||
struct kset *kset;
|
struct kset *kset;
|
||||||
|
int retval;
|
||||||
|
|
||||||
kset = kzalloc(sizeof(*kset), GFP_KERNEL);
|
kset = kzalloc(sizeof(*kset), GFP_KERNEL);
|
||||||
if (!kset)
|
if (!kset)
|
||||||
return NULL;
|
return NULL;
|
||||||
kobject_set_name(&kset->kobj, name);
|
retval = kobject_set_name(&kset->kobj, name);
|
||||||
|
if (retval) {
|
||||||
|
kfree(kset);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
kset->uevent_ops = uevent_ops;
|
kset->uevent_ops = uevent_ops;
|
||||||
kset->kobj.parent = parent_kobj;
|
kset->kobj.parent = parent_kobj;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue