[patch] fix prom.c compile warning

Amos Waterland apw at us.ibm.com
Fri Apr 1 05:34:58 EST 2005

The code in unflatten_device_tree knows that get_property is written to
only return with lenp equal to 1 when also returning a valid pointer.
The gcc 3.3.3 compiler is not able to prove this to itself, so it warns
about a possible uninitialized pointer dereference:

 .../arch/ppc64/kernel/prom.c: In function `unflatten_device_tree':
 warning: `p' might be used uninitialized in this function

Unless it is desired to rework the interaction between the two
functions, this will keep the existing behavior but quiet the compiler.

Signed-off-by: Amos Waterland <apw at us.ibm.com>

===== arch/ppc64/kernel/prom.c 1.127 vs edited =====
--- 1.127/arch/ppc64/kernel/prom.c	2005-03-28 17:21:21 -05:00
+++ edited/arch/ppc64/kernel/prom.c	2005-03-31 13:40:42 -05:00
@@ -825,7 +825,7 @@
 	unsigned long start, mem, size;
 	struct device_node **allnextp = &allnodes;
-	char *p;
+	char *p = NULL;
 	int l = 0;
 	DBG(" -> unflatten_device_tree()\n");

More information about the Linuxppc64-dev mailing list