aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-01-30 13:33:45 +0100
committerIngo Molnar <mingo@elte.hu>2008-01-30 13:33:45 +0100
commitbd796ed0232a036f5ab14ac68d0a05f791ebcc3b (patch)
tree61ad5d8effd73c1b0242f3e08863184abc4e84ee
parenta8efa1cd51d6f6407df5f42d8f1a7e9fc7178d1a (diff)
x86: add debug warnings to early_ioremap()
Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r--arch/x86/mm/ioremap_32.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/arch/x86/mm/ioremap_32.c b/arch/x86/mm/ioremap_32.c
index 63f76ecae44..4bcd5e065df 100644
--- a/arch/x86/mm/ioremap_32.c
+++ b/arch/x86/mm/ioremap_32.c
@@ -306,12 +306,15 @@ void __init *early_ioremap(unsigned long phys_addr, unsigned long size)
/* Don't allow wraparound or zero size */
last_addr = phys_addr + size - 1;
- if (!size || last_addr < phys_addr)
+ if (!size || last_addr < phys_addr) {
+ WARN_ON(1);
return NULL;
+ }
- if (nesting >= FIX_BTMAPS_NESTING)
+ if (nesting >= FIX_BTMAPS_NESTING) {
+ WARN_ON(1);
return NULL;
-
+ }
early_ioremap_nested++;
/*
* Mappings have to be page-aligned
@@ -324,8 +327,10 @@ void __init *early_ioremap(unsigned long phys_addr, unsigned long size)
* Mappings have to fit in the FIX_BTMAP area.
*/
nrpages = size >> PAGE_SHIFT;
- if (nrpages > NR_FIX_BTMAPS)
+ if (nrpages > NR_FIX_BTMAPS) {
+ WARN_ON(1);
return NULL;
+ }
/*
* Ok, go for it..
@@ -351,11 +356,13 @@ void __init early_iounmap(void *addr, unsigned long size)
unsigned int nesting;
nesting = --early_ioremap_nested;
+ WARN_ON(nesting < 0);
virt_addr = (unsigned long)addr;
- if (virt_addr < fix_to_virt(FIX_BTMAP_BEGIN))
+ if (virt_addr < fix_to_virt(FIX_BTMAP_BEGIN)) {
+ WARN_ON(1);
return;
-
+ }
offset = virt_addr & ~PAGE_MASK;
nrpages = PAGE_ALIGN(offset + size - 1) >> PAGE_SHIFT;