mirror of
https://github.com/adulau/aha.git
synced 2024-12-27 03:06:10 +00:00
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>
This commit is contained in:
parent
f810a5cf28
commit
5cd2b459d3
4 changed files with 15 additions and 22 deletions
|
@ -205,9 +205,8 @@ static void debug_print_object(struct debug_obj *obj, char *msg)
|
||||||
|
|
||||||
if (limit < 5 && obj->descr != descr_test) {
|
if (limit < 5 && obj->descr != descr_test) {
|
||||||
limit++;
|
limit++;
|
||||||
printk(KERN_ERR "ODEBUG: %s %s object type: %s\n", msg,
|
WARN(1, KERN_ERR "ODEBUG: %s %s object type: %s\n", msg,
|
||||||
obj_states[obj->state], obj->descr->name);
|
obj_states[obj->state], obj->descr->name);
|
||||||
WARN_ON(1);
|
|
||||||
}
|
}
|
||||||
debug_objects_warnings++;
|
debug_objects_warnings++;
|
||||||
}
|
}
|
||||||
|
@ -733,26 +732,22 @@ check_results(void *addr, enum debug_obj_state state, int fixups, int warnings)
|
||||||
|
|
||||||
obj = lookup_object(addr, db);
|
obj = lookup_object(addr, db);
|
||||||
if (!obj && state != ODEBUG_STATE_NONE) {
|
if (!obj && state != ODEBUG_STATE_NONE) {
|
||||||
printk(KERN_ERR "ODEBUG: selftest object not found\n");
|
WARN(1, KERN_ERR "ODEBUG: selftest object not found\n");
|
||||||
WARN_ON(1);
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (obj && obj->state != state) {
|
if (obj && obj->state != state) {
|
||||||
printk(KERN_ERR "ODEBUG: selftest wrong state: %d != %d\n",
|
WARN(1, KERN_ERR "ODEBUG: selftest wrong state: %d != %d\n",
|
||||||
obj->state, state);
|
obj->state, state);
|
||||||
WARN_ON(1);
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (fixups != debug_objects_fixups) {
|
if (fixups != debug_objects_fixups) {
|
||||||
printk(KERN_ERR "ODEBUG: selftest fixups failed %d != %d\n",
|
WARN(1, KERN_ERR "ODEBUG: selftest fixups failed %d != %d\n",
|
||||||
fixups, debug_objects_fixups);
|
fixups, debug_objects_fixups);
|
||||||
WARN_ON(1);
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (warnings != debug_objects_warnings) {
|
if (warnings != debug_objects_warnings) {
|
||||||
printk(KERN_ERR "ODEBUG: selftest warnings failed %d != %d\n",
|
WARN(1, KERN_ERR "ODEBUG: selftest warnings failed %d != %d\n",
|
||||||
warnings, debug_objects_warnings);
|
warnings, debug_objects_warnings);
|
||||||
WARN_ON(1);
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
res = 0;
|
res = 0;
|
||||||
|
|
|
@ -40,8 +40,7 @@ static void bad_io_access(unsigned long port, const char *access)
|
||||||
static int count = 10;
|
static int count = 10;
|
||||||
if (count) {
|
if (count) {
|
||||||
count--;
|
count--;
|
||||||
printk(KERN_ERR "Bad IO access at port %#lx (%s)\n", port, access);
|
WARN(1, KERN_ERR "Bad IO access at port %#lx (%s)\n", port, access);
|
||||||
WARN_ON(1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -285,8 +285,7 @@ int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...)
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
if (env->envp_idx >= ARRAY_SIZE(env->envp)) {
|
if (env->envp_idx >= ARRAY_SIZE(env->envp)) {
|
||||||
printk(KERN_ERR "add_uevent_var: too many keys\n");
|
WARN(1, KERN_ERR "add_uevent_var: too many keys\n");
|
||||||
WARN_ON(1);
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,8 +296,7 @@ int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...)
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
if (len >= (sizeof(env->buf) - env->buflen)) {
|
if (len >= (sizeof(env->buf) - env->buflen)) {
|
||||||
printk(KERN_ERR "add_uevent_var: buffer size too small\n");
|
WARN(1, KERN_ERR "add_uevent_var: buffer size too small\n");
|
||||||
WARN_ON(1);
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
13
lib/plist.c
13
lib/plist.c
|
@ -31,12 +31,13 @@
|
||||||
static void plist_check_prev_next(struct list_head *t, struct list_head *p,
|
static void plist_check_prev_next(struct list_head *t, struct list_head *p,
|
||||||
struct list_head *n)
|
struct list_head *n)
|
||||||
{
|
{
|
||||||
if (n->prev != p || p->next != n) {
|
WARN(n->prev != p || p->next != n,
|
||||||
printk("top: %p, n: %p, p: %p\n", t, t->next, t->prev);
|
"top: %p, n: %p, p: %p\n"
|
||||||
printk("prev: %p, n: %p, p: %p\n", p, p->next, p->prev);
|
"prev: %p, n: %p, p: %p\n"
|
||||||
printk("next: %p, n: %p, p: %p\n", n, n->next, n->prev);
|
"next: %p, n: %p, p: %p\n",
|
||||||
WARN_ON(1);
|
t, t->next, t->prev,
|
||||||
}
|
p, p->next, p->prev,
|
||||||
|
n, n->next, n->prev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void plist_check_list(struct list_head *top)
|
static void plist_check_list(struct list_head *top)
|
||||||
|
|
Loading…
Reference in a new issue