Commit 8c20fafa authored by Michael Ellerman's avatar Michael Ellerman Committed by Paul Mackerras

[PATCH] powerpc: Make sure we don't create empty lmb regions

To prevent problems later in boot, make sure we don't create zero-size lmb
regions.

I've checked all the callers, and at the moment no one should ever hit this.
All callers use a constant size, or they check the computed size before they
call us.
Signed-off-by: default avatarMichael Ellerman <michael@ellerman.id.au>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent fa938953
...@@ -197,6 +197,8 @@ long __init lmb_reserve(unsigned long base, unsigned long size) ...@@ -197,6 +197,8 @@ long __init lmb_reserve(unsigned long base, unsigned long size)
{ {
struct lmb_region *_rgn = &(lmb.reserved); struct lmb_region *_rgn = &(lmb.reserved);
BUG_ON(0 == size);
return lmb_add_region(_rgn, base, size); return lmb_add_region(_rgn, base, size);
} }
...@@ -227,6 +229,8 @@ unsigned long __init lmb_alloc_base(unsigned long size, unsigned long align, ...@@ -227,6 +229,8 @@ unsigned long __init lmb_alloc_base(unsigned long size, unsigned long align,
long i, j; long i, j;
unsigned long base = 0; unsigned long base = 0;
BUG_ON(0 == size);
#ifdef CONFIG_PPC32 #ifdef CONFIG_PPC32
/* On 32-bit, make sure we allocate lowmem */ /* On 32-bit, make sure we allocate lowmem */
if (max_addr == LMB_ALLOC_ANYWHERE) if (max_addr == LMB_ALLOC_ANYWHERE)
......
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