diff options
Diffstat (limited to 'lib/kobject.c')
-rw-r--r-- | lib/kobject.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/kobject.c b/lib/kobject.c index 7919c32a3a1..4d52b6f534b 100644 --- a/lib/kobject.c +++ b/lib/kobject.c @@ -133,7 +133,6 @@ void kobject_init(struct kobject * kobj) return; kref_init(&kobj->kref); INIT_LIST_HEAD(&kobj->entry); - kobj->kset = kset_get(kobj->kset); } @@ -184,7 +183,7 @@ int kobject_add(struct kobject * kobj) kobj->kset ? kobject_name(&kobj->kset->kobj) : "<NULL>" ); if (kobj->kset) { - spin_lock(&kobj->kset->list_lock); + kobj->kset = kset_get(kobj->kset); if (!parent) { parent = kobject_get(&kobj->kset->kobj); @@ -196,7 +195,8 @@ int kobject_add(struct kobject * kobj) kobject_get(parent); } - list_add_tail(&kobj->entry,&kobj->kset->list); + spin_lock(&kobj->kset->list_lock); + list_add_tail(&kobj->entry, &kobj->kset->list); spin_unlock(&kobj->kset->list_lock); kobj->parent = parent; } |