x86: add early_ioremap() leak detection
authorIngo Molnar <mingo@elte.hu>
Wed, 30 Jan 2008 12:33:47 +0000 (13:33 +0100)
committerIngo Molnar <mingo@elte.hu>
Wed, 30 Jan 2008 12:33:47 +0000 (13:33 +0100)
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
arch/x86/mm/ioremap_32.c

index 7f7daf50efedd240ff8c06b98b30422ab9e0f75a..b743de841f68af735ff026baa5df14339e63339f 100644 (file)
@@ -311,6 +311,22 @@ static inline void __init early_clear_fixmap(enum fixed_addresses idx)
 
 int __initdata early_ioremap_nested;
 
+static int __init check_early_ioremap_leak(void)
+{
+       if (!early_ioremap_nested)
+               return 0;
+
+       printk(KERN_WARNING
+               "Debug warning: early ioremap leak of %d areas detected.\n",
+                       early_ioremap_nested);
+       printk(KERN_WARNING
+               "please boot with early_ioremap_debug and report the dmesg.\n");
+       WARN_ON(1);
+
+       return 1;
+}
+late_initcall(check_early_ioremap_leak);
+
 void __init *early_ioremap(unsigned long phys_addr, unsigned long size)
 {
        unsigned long offset, last_addr;