diff options
-rw-r--r-- | mm/slub.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/mm/slub.c b/mm/slub.c index d26177fb293..5cc4b7dddb5 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -4025,13 +4025,12 @@ static int sysfs_slab_add(struct kmem_cache *s) name = create_unique_id(s); } - kobject_set_name(&s->kobj, name); s->kobj.kset = slab_kset; - s->kobj.ktype = &slab_ktype; - kobject_init(&s->kobj); - err = kobject_add(&s->kobj); - if (err) + err = kobject_init_and_add(&s->kobj, &slab_ktype, NULL, name); + if (err) { + kobject_put(&s->kobj); return err; + } err = sysfs_create_group(&s->kobj, &slab_attr_group); if (err) |