summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/ppc64/kernel/prom_init.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/arch/ppc64/kernel/prom_init.c b/arch/ppc64/kernel/prom_init.c
index 88aaa02c57e8..f62bda79e102 100644
--- a/arch/ppc64/kernel/prom_init.c
+++ b/arch/ppc64/kernel/prom_init.c
@@ -587,19 +587,20 @@ static unsigned long __init prom_next_cell(int s, cell_t **cellp)
static void reserve_mem(unsigned long base, unsigned long size)
{
unsigned long offset = reloc_offset();
+ unsigned long top = base + size;
unsigned long cnt = RELOC(mem_reserve_cnt);
- if (!size)
+ if (size == 0)
return;
- base = _ALIGN_DOWN(base, PAGE_SIZE);
- size = _ALIGN_UP(size, PAGE_SIZE);
-
- /*
- * We need to always keep one empty entry so that we
+ /* We need to always keep one empty entry so that we
* have our terminator with "size" set to 0 since we are
* dumb and just copy this entire array to the boot params
*/
+ base = _ALIGN_DOWN(base, PAGE_SIZE);
+ top = _ALIGN_UP(top, PAGE_SIZE);
+ size = top - base;
+
if (cnt >= (MEM_RESERVE_MAP_SIZE - 1))
prom_panic("Memory reserve map exhausted !\n");
RELOC(mem_reserve_map)[cnt].base = base;