]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] list_del debug check
authorManfred Spraul <manfred@colorfullife.com>
Fri, 29 Sep 2006 08:59:01 +0000 (01:59 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 29 Sep 2006 16:18:05 +0000 (09:18 -0700)
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>
lib/list_debug.c

index 1aae85cef92cbb639334b02662cf684a45b91560..e80d27c9789820d867139428650d6cbd88812165 100644 (file)
@@ -59,14 +59,17 @@ EXPORT_SYMBOL(list_add);
  */
 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)) {
-               printk(KERN_ERR "list_del corruption. prev->next should be %p, but was %p\n",
-                       entry, entry->prev->next);
+               printk(KERN_ERR "list_del corruption. prev->next should be %p, "
+                               "but was %p\n", entry, entry->prev->next);
                BUG();
        }
        if (unlikely(entry->next->prev != entry)) {
-               printk(KERN_ERR "list_del corruption. next->prev should be %p, but was %p\n",
-                       entry, entry->next->prev);
+               printk(KERN_ERR "list_del corruption. next->prev should be %p, "
+                               "but was %p\n", entry, entry->next->prev);
                BUG();
        }
        __list_del(entry->prev, entry->next);
@@ -74,4 +77,3 @@ void list_del(struct list_head *entry)
        entry->prev = LIST_POISON2;
 }
 EXPORT_SYMBOL(list_del);
-