diff options
author | Deepak Nibade <dnibade@nvidia.com> | 2013-08-14 16:23:39 +0530 |
---|---|---|
committer | Deepak Nibade <dnibade@nvidia.com> | 2013-08-14 16:23:39 +0530 |
commit | 9282699d7fd7954f11d59254e568e5d4bfbbe71a (patch) | |
tree | 4d945260bc8eb63b0db0423ad55ad7021eb5d4ac /lib | |
parent | 933d6b11dbd7fda89ac094321d0cd9992afb5592 (diff) | |
parent | 67e6589a34ea5360b00869aaaec4a844c29cf713 (diff) |
Merge branch 'linux-3.4.57' into rel-17
Bug 1348440
Change-Id: If25c49f027dc2a69642f7ed4733e965962b2a5a2
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/klist.c | 2 | ||||
-rw-r--r-- | lib/kobject.c | 9 |
2 files changed, 9 insertions, 2 deletions
diff --git a/lib/klist.c b/lib/klist.c index 0874e41609a6..358a368a2947 100644 --- a/lib/klist.c +++ b/lib/klist.c @@ -193,10 +193,10 @@ static void klist_release(struct kref *kref) if (waiter->node != n) continue; + list_del(&waiter->list); waiter->woken = 1; mb(); wake_up_process(waiter->process); - list_del(&waiter->list); } spin_unlock(&klist_remove_lock); knode_set_klist(n, NULL); diff --git a/lib/kobject.c b/lib/kobject.c index aeefa8bc8b1c..d90c69286ba9 100644 --- a/lib/kobject.c +++ b/lib/kobject.c @@ -531,6 +531,13 @@ struct kobject *kobject_get(struct kobject *kobj) return kobj; } +static struct kobject *kobject_get_unless_zero(struct kobject *kobj) +{ + if (!kref_get_unless_zero(&kobj->kref)) + kobj = NULL; + return kobj; +} + /* * kobject_cleanup - free kobject resources. * @kobj: object to cleanup @@ -753,7 +760,7 @@ struct kobject *kset_find_obj(struct kset *kset, const char *name) list_for_each_entry(k, &kset->list, entry) { if (kobject_name(k) && !strcmp(kobject_name(k), name)) { - ret = kobject_get(k); + ret = kobject_get_unless_zero(k); break; } } |