tree f74faa0172cc88148e00b1484fd97fa90d2d9d23
parent 145ec7d51ae507c7cc8889ad05e24af05bbd9147
author Michael Ellerman <[EMAIL PROTECTED]> Tue, 09 Aug 2005 15:20:19 +1000
committer Paul Mackerras <[EMAIL PROTECTED]> Mon, 29 Aug 2005 10:53:38 +1000

[PATCH] ppc64: unflatten_device_tree() should check if lmb_alloc() fails

unflatten_device_tree() doesn't check if lmb_alloc() succeeds or not, it
should. All it can do is panic, but at least there's an error message
(assuming you have some sort of console at that point).

Signed-off-by: Michael Ellerman <[EMAIL PROTECTED]>

 arch/ppc64/kernel/prom.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
Signed-off-by: Paul Mackerras <[EMAIL PROTECTED]>

 arch/ppc64/kernel/prom.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/ppc64/kernel/prom.c b/arch/ppc64/kernel/prom.c
--- a/arch/ppc64/kernel/prom.c
+++ b/arch/ppc64/kernel/prom.c
@@ -950,8 +950,13 @@ void __init unflatten_device_tree(void)
        DBG("  size is %lx, allocating...\n", size);
 
        /* Allocate memory for the expanded device tree */
-       mem = (unsigned long)abs_to_virt(lmb_alloc(size + 4,
-                                                  __alignof__(struct 
device_node)));
+       mem = lmb_alloc(size + 4, __alignof__(struct device_node));
+       if (!mem) {
+               DBG("Couldn't allocate memory with lmb_alloc()!\n");
+               panic("Couldn't allocate memory with lmb_alloc()!\n");
+       }
+       mem = (unsigned long)abs_to_virt(mem);
+
        ((u32 *)mem)[size / 4] = 0xdeadbeef;
 
        DBG("  unflattening...\n", mem);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to