Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 362501
b: refs/heads/master
c: a49b7e8
h: refs/heads/master
i:
  362499: b398082
v: v3
  • Loading branch information
Linus Torvalds committed Apr 13, 2013
1 parent bae4b5c commit 3571123
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1de14c3c5cbc9bb17e9dcc648cda51c0c85d54b9
refs/heads/master: a49b7e82cab0f9b41f483359be83f44fbb6b4979
9 changes: 8 additions & 1 deletion trunk/lib/kobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,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
Expand Down Expand Up @@ -751,7 +758,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;
}
}
Expand Down

0 comments on commit 3571123

Please sign in to comment.