[PATCH] ppc64: fix fixup_device_tree

Arnd Bergmann arnd at arndb.de
Wed Jun 1 19:07:31 EST 2005


The new fixup_device_tree function breaks on some open firmware
implementations that can't deal with invalid phandle values passed
to prom_getprop().
The current code attempts to check the validity of the phandle
returned from finddevice but fails to do that correctly, because
(0x00000000fffffffful <= 0) is false.
I suggest comparing the returned phandle to the expected
value directly.

Signed-off-by: Arnd Bergmann <arndb at de.ibm.com

--- linux-cg.orig/arch/ppc64/kernel/prom_init.c	2005-05-31 12:42:34.000000000 -0400
+++ linux-cg/arch/ppc64/kernel/prom_init.c	2005-06-01 07:22:20.349949064 -0400
@@ -1770,13 +1770,13 @@ static void __init fixup_device_tree(voi
 
 	/* Some G5s have a missing interrupt definition, fix it up here */
 	u3 = call_prom("finddevice", 1, 1, ADDR("/u3 at 0,f8000000"));
-	if ((long)u3 <= 0)
+	if (u3 == -1u)
 		return;
 	i2c = call_prom("finddevice", 1, 1, ADDR("/u3 at 0,f8000000/i2c at f8001000"));
-	if ((long)i2c <= 0)
+	if (i2c == -1u)
 		return;
 	mpic = call_prom("finddevice", 1, 1, ADDR("/u3 at 0,f8000000/mpic at f8040000"));
-	if ((long)mpic <= 0)
+	if (mpic == -1u)
 		return;
 
 	/* check if proper rev of u3 */



More information about the Linuxppc64-dev mailing list