diff options
author | Arjan van de Ven <arjan@linux.intel.com> | 2008-07-25 22:45:39 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-26 15:00:07 -0400 |
commit | 5cd2b459d326a424671dcd95f038649f7bf7cb96 (patch) | |
tree | 824514753e173bb69d3fde5fab18f8ddf909751d | |
parent | f810a5cf28a818db96333cd23646f0227ec015b4 (diff) |
Use WARN() in lib/
Use WARN() instead of a printk+WARN_ON() pair; this way the message becomes
part of the warning section for better reporting/collection. In addition, one
of the if() clauses collapes into the WARN() entirely now.
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | lib/debugobjects.c | 15 | ||||
-rw-r--r-- | lib/iomap.c | 3 | ||||
-rw-r--r-- | lib/kobject_uevent.c | 6 | ||||
-rw-r--r-- | lib/plist.c | 13 |
4 files changed, 15 insertions, 22 deletions
diff --git a/lib/debugobjects.c b/lib/debugobjects.c index f86196390cfd..45a6bde762d1 100644 --- a/lib/debugobjects.c +++ b/lib/debugobjects.c | |||
@@ -205,9 +205,8 @@ static void debug_print_object(struct debug_obj *obj, char *msg) | |||
205 | 205 | ||
206 | if (limit < 5 && obj->descr != descr_test) { | 206 | if (limit < 5 && obj->descr != descr_test) { |
207 | limit++; | 207 | limit++; |
208 | printk(KERN_ERR "ODEBUG: %s %s object type: %s\n", msg, | 208 | WARN(1, KERN_ERR "ODEBUG: %s %s object type: %s\n", msg, |
209 | obj_states[obj->state], obj->descr->name); | 209 | obj_states[obj->state], obj->descr->name); |
210 | WARN_ON(1); | ||
211 | } | 210 | } |
212 | debug_objects_warnings++; | 211 | debug_objects_warnings++; |
213 | } | 212 | } |
@@ -733,26 +732,22 @@ check_results(void *addr, enum debug_obj_state state, int fixups, int warnings) | |||
733 | 732 | ||
734 | obj = lookup_object(addr, db); | 733 | obj = lookup_object(addr, db); |
735 | if (!obj && state != ODEBUG_STATE_NONE) { | 734 | if (!obj && state != ODEBUG_STATE_NONE) { |
736 | printk(KERN_ERR "ODEBUG: selftest object not found\n"); | 735 | WARN(1, KERN_ERR "ODEBUG: selftest object not found\n"); |
737 | WARN_ON(1); | ||
738 | goto out; | 736 | goto out; |
739 | } | 737 | } |
740 | if (obj && obj->state != state) { | 738 | if (obj && obj->state != state) { |
741 | printk(KERN_ERR "ODEBUG: selftest wrong state: %d != %d\n", | 739 | WARN(1, KERN_ERR "ODEBUG: selftest wrong state: %d != %d\n", |
742 | obj->state, state); | 740 | obj->state, state); |
743 | WARN_ON(1); | ||
744 | goto out; | 741 | goto out; |
745 | } | 742 | } |
746 | if (fixups != debug_objects_fixups) { | 743 | if (fixups != debug_objects_fixups) { |
747 | printk(KERN_ERR "ODEBUG: selftest fixups failed %d != %d\n", | 744 | WARN(1, KERN_ERR "ODEBUG: selftest fixups failed %d != %d\n", |
748 | fixups, debug_objects_fixups); | 745 | fixups, debug_objects_fixups); |
749 | WARN_ON(1); | ||
750 | goto out; | 746 | goto out; |
751 | } | 747 | } |
752 | if (warnings != debug_objects_warnings) { | 748 | if (warnings != debug_objects_warnings) { |
753 | printk(KERN_ERR "ODEBUG: selftest warnings failed %d != %d\n", | 749 | WARN(1, KERN_ERR "ODEBUG: selftest warnings failed %d != %d\n", |
754 | warnings, debug_objects_warnings); | 750 | warnings, debug_objects_warnings); |
755 | WARN_ON(1); | ||
756 | goto out; | 751 | goto out; |
757 | } | 752 | } |
758 | res = 0; | 753 | res = 0; |
diff --git a/lib/iomap.c b/lib/iomap.c index 37a3ea4cac9f..d32229385151 100644 --- a/lib/iomap.c +++ b/lib/iomap.c | |||
@@ -40,8 +40,7 @@ static void bad_io_access(unsigned long port, const char *access) | |||
40 | static int count = 10; | 40 | static int count = 10; |
41 | if (count) { | 41 | if (count) { |
42 | count--; | 42 | count--; |
43 | printk(KERN_ERR "Bad IO access at port %#lx (%s)\n", port, access); | 43 | WARN(1, KERN_ERR "Bad IO access at port %#lx (%s)\n", port, access); |
44 | WARN_ON(1); | ||
45 | } | 44 | } |
46 | } | 45 | } |
47 | 46 | ||
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c index 9f8d599459d1..3f914725bda8 100644 --- a/lib/kobject_uevent.c +++ b/lib/kobject_uevent.c | |||
@@ -285,8 +285,7 @@ int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...) | |||
285 | int len; | 285 | int len; |
286 | 286 | ||
287 | if (env->envp_idx >= ARRAY_SIZE(env->envp)) { | 287 | if (env->envp_idx >= ARRAY_SIZE(env->envp)) { |
288 | printk(KERN_ERR "add_uevent_var: too many keys\n"); | 288 | WARN(1, KERN_ERR "add_uevent_var: too many keys\n"); |
289 | WARN_ON(1); | ||
290 | return -ENOMEM; | 289 | return -ENOMEM; |
291 | } | 290 | } |
292 | 291 | ||
@@ -297,8 +296,7 @@ int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...) | |||
297 | va_end(args); | 296 | va_end(args); |
298 | 297 | ||
299 | if (len >= (sizeof(env->buf) - env->buflen)) { | 298 | if (len >= (sizeof(env->buf) - env->buflen)) { |
300 | printk(KERN_ERR "add_uevent_var: buffer size too small\n"); | 299 | WARN(1, KERN_ERR "add_uevent_var: buffer size too small\n"); |
301 | WARN_ON(1); | ||
302 | return -ENOMEM; | 300 | return -ENOMEM; |
303 | } | 301 | } |
304 | 302 | ||
diff --git a/lib/plist.c b/lib/plist.c index 3074a02272f3..d6c64a824e1d 100644 --- a/lib/plist.c +++ b/lib/plist.c | |||
@@ -31,12 +31,13 @@ | |||
31 | static void plist_check_prev_next(struct list_head *t, struct list_head *p, | 31 | static void plist_check_prev_next(struct list_head *t, struct list_head *p, |
32 | struct list_head *n) | 32 | struct list_head *n) |
33 | { | 33 | { |
34 | if (n->prev != p || p->next != n) { | 34 | WARN(n->prev != p || p->next != n, |
35 | printk("top: %p, n: %p, p: %p\n", t, t->next, t->prev); | 35 | "top: %p, n: %p, p: %p\n" |
36 | printk("prev: %p, n: %p, p: %p\n", p, p->next, p->prev); | 36 | "prev: %p, n: %p, p: %p\n" |
37 | printk("next: %p, n: %p, p: %p\n", n, n->next, n->prev); | 37 | "next: %p, n: %p, p: %p\n", |
38 | WARN_ON(1); | 38 | t, t->next, t->prev, |
39 | } | 39 | p, p->next, p->prev, |
40 | n, n->next, n->prev); | ||
40 | } | 41 | } |
41 | 42 | ||
42 | static void plist_check_list(struct list_head *top) | 43 | static void plist_check_list(struct list_head *top) |