diff options
author | Arjan van de Ven <arjan@linux.intel.com> | 2008-07-25 04:45:55 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-25 13:53:29 -0400 |
commit | d955c78ac4699ac9c3fe07be62982cda13d13267 (patch) | |
tree | c2288e46ad681c2bc391a0bb2b40426b813c8a51 | |
parent | 7a2c477069fbd32f91598f05334003979b987a39 (diff) |
Example use of WARN()
Now that WARN() exists, we can fold some of the printk's into it.
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | lib/kobject.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/kobject.c b/lib/kobject.c index 744401571ed7..bd732ffebc85 100644 --- a/lib/kobject.c +++ b/lib/kobject.c | |||
@@ -164,9 +164,8 @@ static int kobject_add_internal(struct kobject *kobj) | |||
164 | return -ENOENT; | 164 | return -ENOENT; |
165 | 165 | ||
166 | if (!kobj->name || !kobj->name[0]) { | 166 | if (!kobj->name || !kobj->name[0]) { |
167 | pr_debug("kobject: (%p): attempted to be registered with empty " | 167 | WARN(1, "kobject: (%p): attempted to be registered with empty " |
168 | "name!\n", kobj); | 168 | "name!\n", kobj); |
169 | WARN_ON(1); | ||
170 | return -EINVAL; | 169 | return -EINVAL; |
171 | } | 170 | } |
172 | 171 | ||
@@ -583,12 +582,10 @@ static void kobject_release(struct kref *kref) | |||
583 | void kobject_put(struct kobject *kobj) | 582 | void kobject_put(struct kobject *kobj) |
584 | { | 583 | { |
585 | if (kobj) { | 584 | if (kobj) { |
586 | if (!kobj->state_initialized) { | 585 | if (!kobj->state_initialized) |
587 | printk(KERN_WARNING "kobject: '%s' (%p): is not " | 586 | WARN(1, KERN_WARNING "kobject: '%s' (%p): is not " |
588 | "initialized, yet kobject_put() is being " | 587 | "initialized, yet kobject_put() is being " |
589 | "called.\n", kobject_name(kobj), kobj); | 588 | "called.\n", kobject_name(kobj), kobj); |
590 | WARN_ON(1); | ||
591 | } | ||
592 | kref_put(&kobj->kref, kobject_release); | 589 | kref_put(&kobj->kref, kobject_release); |
593 | } | 590 | } |
594 | } | 591 | } |