diff options
-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 7919c32a3a15..4d52b6f534bc 100644 --- a/lib/kobject.c +++ b/lib/kobject.c | |||
@@ -133,7 +133,6 @@ void kobject_init(struct kobject * kobj) | |||
133 | return; | 133 | return; |
134 | kref_init(&kobj->kref); | 134 | kref_init(&kobj->kref); |
135 | INIT_LIST_HEAD(&kobj->entry); | 135 | INIT_LIST_HEAD(&kobj->entry); |
136 | kobj->kset = kset_get(kobj->kset); | ||
137 | } | 136 | } |
138 | 137 | ||
139 | 138 | ||
@@ -184,7 +183,7 @@ int kobject_add(struct kobject * kobj) | |||
184 | kobj->kset ? kobject_name(&kobj->kset->kobj) : "<NULL>" ); | 183 | kobj->kset ? kobject_name(&kobj->kset->kobj) : "<NULL>" ); |
185 | 184 | ||
186 | if (kobj->kset) { | 185 | if (kobj->kset) { |
187 | spin_lock(&kobj->kset->list_lock); | 186 | kobj->kset = kset_get(kobj->kset); |
188 | 187 | ||
189 | if (!parent) { | 188 | if (!parent) { |
190 | parent = kobject_get(&kobj->kset->kobj); | 189 | parent = kobject_get(&kobj->kset->kobj); |
@@ -196,7 +195,8 @@ int kobject_add(struct kobject * kobj) | |||
196 | kobject_get(parent); | 195 | kobject_get(parent); |
197 | } | 196 | } |
198 | 197 | ||
199 | list_add_tail(&kobj->entry,&kobj->kset->list); | 198 | spin_lock(&kobj->kset->list_lock); |
199 | list_add_tail(&kobj->entry, &kobj->kset->list); | ||
200 | spin_unlock(&kobj->kset->list_lock); | 200 | spin_unlock(&kobj->kset->list_lock); |
201 | kobj->parent = parent; | 201 | kobj->parent = parent; |
202 | } | 202 | } |