diff options
| author | Patrick Mochel <mochel@osdl.org> | 2003-06-04 23:48:47 -0700 |
|---|---|---|
| committer | Patrick Mochel <mochel@osdl.org> | 2003-06-04 23:48:47 -0700 |
| commit | ed35f39b47e43ec1dd78e2749bb9ea9762442c2b (patch) | |
| tree | cad65bc81882ff56412fc2318d336ec17557bb03 /lib/kobject.c | |
| parent | ace11a78957de6064420e861db938c5901f7cb93 (diff) | |
[kobject] Add warning + back trace if kobject_get() is called with 0 refcount.
Diffstat (limited to 'lib/kobject.c')
| -rw-r--r-- | lib/kobject.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/kobject.c b/lib/kobject.c index 21f876504c5e..661bf12797cf 100644 --- a/lib/kobject.c +++ b/lib/kobject.c @@ -347,9 +347,10 @@ struct kobject * kobject_get(struct kobject * kobj) { struct kobject * ret = kobj; - if (kobj) + if (kobj) { + WARN_ON(!atomic_read(&kobj->refcount)); atomic_inc(&kobj->refcount); - else + } else ret = NULL; return ret; } |
