diff options
-rw-r--r-- | lib/kobject.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/kobject.c b/lib/kobject.c index bacf6fe4f7a0..b512b746d2af 100644 --- a/lib/kobject.c +++ b/lib/kobject.c | |||
@@ -793,11 +793,16 @@ static struct kset *kset_create(const char *name, | |||
793 | struct kobject *parent_kobj) | 793 | struct kobject *parent_kobj) |
794 | { | 794 | { |
795 | struct kset *kset; | 795 | struct kset *kset; |
796 | int retval; | ||
796 | 797 | ||
797 | kset = kzalloc(sizeof(*kset), GFP_KERNEL); | 798 | kset = kzalloc(sizeof(*kset), GFP_KERNEL); |
798 | if (!kset) | 799 | if (!kset) |
799 | return NULL; | 800 | return NULL; |
800 | kobject_set_name(&kset->kobj, name); | 801 | retval = kobject_set_name(&kset->kobj, name); |
802 | if (retval) { | ||
803 | kfree(kset); | ||
804 | return NULL; | ||
805 | } | ||
801 | kset->uevent_ops = uevent_ops; | 806 | kset->uevent_ops = uevent_ops; |
802 | kset->kobj.parent = parent_kobj; | 807 | kset->kobj.parent = parent_kobj; |
803 | 808 | ||