Commit ed35f39b authored by Patrick Mochel's avatar Patrick Mochel

[kobject] Add warning + back trace if kobject_get() is called with 0 refcount.

parent ace11a78
...@@ -347,9 +347,10 @@ struct kobject * kobject_get(struct kobject * kobj) ...@@ -347,9 +347,10 @@ struct kobject * kobject_get(struct kobject * kobj)
{ {
struct kobject * ret = kobj; struct kobject * ret = kobj;
if (kobj) if (kobj) {
WARN_ON(!atomic_read(&kobj->refcount));
atomic_inc(&kobj->refcount); atomic_inc(&kobj->refcount);
else } else
ret = NULL; ret = NULL;
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment