diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2008-02-26 09:36:38 -0800 |
---|---|---|
committer | Stephen Rothwell <sfr@canb.auug.org.au> | 2008-04-04 11:28:56 +1100 |
commit | ee95298cdf3f5d82962e2f220bd3c0f197ef1bb0 (patch) | |
tree | cd6dcd75a6f49c705d14e3df6444ed569ccc3168 /lib | |
parent | 9597362d354f8655ece324b01d0c640a0e99c077 (diff) |
kobject: catch kobjects that are not initialized
Add warnings to kobject_put() to catch kobjects that are cleaned up but
were never initialized to begin with.
Cc: Kay Sievers <kay.sievers@vrfy.org>
Cc: Hannes Reinecke <hare@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/kobject.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/kobject.c b/lib/kobject.c index 0d03252f87a8..60ae9e817663 100644 --- a/lib/kobject.c +++ b/lib/kobject.c @@ -592,8 +592,15 @@ static void kobject_release(struct kref *kref) */ void kobject_put(struct kobject *kobj) { - if (kobj) + if (kobj) { + if (!kobj->state_initialized) { + printk(KERN_WARNING "kobject: '%s' (%p): is not " + "initialized, yet kobject_put() is being " + "called.\n", kobject_name(kobj), kobj); + WARN_ON(1); + } kref_put(&kobj->kref, kobject_release); + } } static void dynamic_kobj_release(struct kobject *kobj) |