diff options
author | Manfred Spraul <manfred@colorfullife.com> | 2006-09-29 04:59:01 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-29 12:18:05 -0400 |
commit | df89a864631f5d840f4873c4c03733b4206e78ea (patch) | |
tree | ea72861bb3348ff740f0ff1e89260eb451666a5b /lib/list_debug.c | |
parent | 199a9afc3dbe98c35326f1d3907ab94dae953a6e (diff) |
[PATCH] list_del debug check
A list_del() debugging check. Has been in -mm for years. Dave moved
list_del() out-of-line in the debug case, so this is now suitable for
mainline.
Cc: Dave Jones <davej@codemonkey.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'lib/list_debug.c')
-rw-r--r-- | lib/list_debug.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/list_debug.c b/lib/list_debug.c index 1aae85cef92c..e80d27c97898 100644 --- a/lib/list_debug.c +++ b/lib/list_debug.c | |||
@@ -59,14 +59,17 @@ EXPORT_SYMBOL(list_add); | |||
59 | */ | 59 | */ |
60 | void list_del(struct list_head *entry) | 60 | void list_del(struct list_head *entry) |
61 | { | 61 | { |
62 | BUG_ON(entry->prev->next != entry); | ||
63 | BUG_ON(entry->next->prev != entry); | ||
64 | |||
62 | if (unlikely(entry->prev->next != entry)) { | 65 | if (unlikely(entry->prev->next != entry)) { |
63 | printk(KERN_ERR "list_del corruption. prev->next should be %p, but was %p\n", | 66 | printk(KERN_ERR "list_del corruption. prev->next should be %p, " |
64 | entry, entry->prev->next); | 67 | "but was %p\n", entry, entry->prev->next); |
65 | BUG(); | 68 | BUG(); |
66 | } | 69 | } |
67 | if (unlikely(entry->next->prev != entry)) { | 70 | if (unlikely(entry->next->prev != entry)) { |
68 | printk(KERN_ERR "list_del corruption. next->prev should be %p, but was %p\n", | 71 | printk(KERN_ERR "list_del corruption. next->prev should be %p, " |
69 | entry, entry->next->prev); | 72 | "but was %p\n", entry, entry->next->prev); |
70 | BUG(); | 73 | BUG(); |
71 | } | 74 | } |
72 | __list_del(entry->prev, entry->next); | 75 | __list_del(entry->prev, entry->next); |
@@ -74,4 +77,3 @@ void list_del(struct list_head *entry) | |||
74 | entry->prev = LIST_POISON2; | 77 | entry->prev = LIST_POISON2; |
75 | } | 78 | } |
76 | EXPORT_SYMBOL(list_del); | 79 | EXPORT_SYMBOL(list_del); |
77 | |||