Commit df89a864 authored by Manfred Spraul's avatar Manfred Spraul Committed by Linus Torvalds

[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: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 199a9afc
...@@ -59,14 +59,17 @@ EXPORT_SYMBOL(list_add); ...@@ -59,14 +59,17 @@ EXPORT_SYMBOL(list_add);
*/ */
void list_del(struct list_head *entry) void list_del(struct list_head *entry)
{ {
BUG_ON(entry->prev->next != entry);
BUG_ON(entry->next->prev != entry);
if (unlikely(entry->prev->next != entry)) { if (unlikely(entry->prev->next != entry)) {
printk(KERN_ERR "list_del corruption. prev->next should be %p, but was %p\n", printk(KERN_ERR "list_del corruption. prev->next should be %p, "
entry, entry->prev->next); "but was %p\n", entry, entry->prev->next);
BUG(); BUG();
} }
if (unlikely(entry->next->prev != entry)) { if (unlikely(entry->next->prev != entry)) {
printk(KERN_ERR "list_del corruption. next->prev should be %p, but was %p\n", printk(KERN_ERR "list_del corruption. next->prev should be %p, "
entry, entry->next->prev); "but was %p\n", entry, entry->next->prev);
BUG(); BUG();
} }
__list_del(entry->prev, entry->next); __list_del(entry->prev, entry->next);
...@@ -74,4 +77,3 @@ void list_del(struct list_head *entry) ...@@ -74,4 +77,3 @@ void list_del(struct list_head *entry)
entry->prev = LIST_POISON2; entry->prev = LIST_POISON2;
} }
EXPORT_SYMBOL(list_del); EXPORT_SYMBOL(list_del);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment