aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Ellerman <michael@ellerman.id.au>2006-01-25 03:31:25 -0500
committerPaul Mackerras <paulus@samba.org>2006-02-07 05:28:38 -0500
commitfa93895329b87112cb1fd784db969e60b5b46af6 (patch)
treeed6d137b47ebcae1de85a21dc387b452fe728163
parent3ea4807de7b2c5c903380ba2c2e7150bee942f42 (diff)
[PATCH] powerpc: Don't allocate zero bytes in finish_device_tree()
In prom.c we run finish_node() on allnodes twice. The first time we just calculate how much memory we'll need, the second time we do the actual work. If the calculation stage determines that we need 0 bytes, then we should skip the lmb allocation. Although an alloc of zero will work, it has been seen to lead to a BUG_ON() in reserve_bootmem() on at least one machine. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r--arch/powerpc/kernel/prom.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index d50c8df0183e..535a33e4aa37 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -491,7 +491,12 @@ void __init finish_device_tree(void)
491 size = 16; 491 size = 16;
492 finish_node(allnodes, &size, 1); 492 finish_node(allnodes, &size, 1);
493 size -= 16; 493 size -= 16;
494 end = start = (unsigned long) __va(lmb_alloc(size, 128)); 494
495 if (0 == size)
496 end = start = 0;
497 else
498 end = start = (unsigned long)__va(lmb_alloc(size, 128));
499
495 finish_node(allnodes, &end, 0); 500 finish_node(allnodes, &end, 0);
496 BUG_ON(end != start + size); 501 BUG_ON(end != start + size);
497 502