Commit bd796ed0 authored by Ingo Molnar's avatar Ingo Molnar

x86: add debug warnings to early_ioremap()

Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent a8efa1cd
...@@ -306,12 +306,15 @@ void __init *early_ioremap(unsigned long phys_addr, unsigned long size) ...@@ -306,12 +306,15 @@ void __init *early_ioremap(unsigned long phys_addr, unsigned long size)
/* Don't allow wraparound or zero size */ /* Don't allow wraparound or zero size */
last_addr = phys_addr + size - 1; last_addr = phys_addr + size - 1;
if (!size || last_addr < phys_addr) if (!size || last_addr < phys_addr) {
WARN_ON(1);
return NULL; return NULL;
}
if (nesting >= FIX_BTMAPS_NESTING) if (nesting >= FIX_BTMAPS_NESTING) {
WARN_ON(1);
return NULL; return NULL;
}
early_ioremap_nested++; early_ioremap_nested++;
/* /*
* Mappings have to be page-aligned * Mappings have to be page-aligned
...@@ -324,8 +327,10 @@ void __init *early_ioremap(unsigned long phys_addr, unsigned long size) ...@@ -324,8 +327,10 @@ void __init *early_ioremap(unsigned long phys_addr, unsigned long size)
* Mappings have to fit in the FIX_BTMAP area. * Mappings have to fit in the FIX_BTMAP area.
*/ */
nrpages = size >> PAGE_SHIFT; nrpages = size >> PAGE_SHIFT;
if (nrpages > NR_FIX_BTMAPS) if (nrpages > NR_FIX_BTMAPS) {
WARN_ON(1);
return NULL; return NULL;
}
/* /*
* Ok, go for it.. * Ok, go for it..
...@@ -351,11 +356,13 @@ void __init early_iounmap(void *addr, unsigned long size) ...@@ -351,11 +356,13 @@ void __init early_iounmap(void *addr, unsigned long size)
unsigned int nesting; unsigned int nesting;
nesting = --early_ioremap_nested; nesting = --early_ioremap_nested;
WARN_ON(nesting < 0);
virt_addr = (unsigned long)addr; 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; return;
}
offset = virt_addr & ~PAGE_MASK; offset = virt_addr & ~PAGE_MASK;
nrpages = PAGE_ALIGN(offset + size - 1) >> PAGE_SHIFT; nrpages = PAGE_ALIGN(offset + size - 1) >> PAGE_SHIFT;
......
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