Thread (3 messages) 3 messages, 2 authors, 2008-03-27

Re: [patch 3/6] PS3: Bootwrapper improvements

From: Geert Uytterhoeven <hidden>
Date: 2008-03-27 08:13:44

On Wed, 26 Mar 2008, Geoff Levand wrote:
quoted hunk ↗ jump to hunk
--- a/arch/powerpc/boot/ps3.c
+++ b/arch/powerpc/boot/ps3.c
 }
 
-void platform_init(void)
+void platform_init(unsigned long null_check)
                      ^^^^^^^^^^^^^^^^^^^^^^^^
quoted hunk ↗ jump to hunk
 {
 	const u32 heapsize = 0x1000000 - (u32)_end; /* 16MiB */
 	void *chosen;
@@ -151,6 +152,10 @@ void platform_init(void)
 
 	printf(" flat tree at 0x%lx\n\r", ft_addr);
 
+	if (*(unsigned long *)0 != null_check)
+		printf("null check failed: %lx != %lx\n\r", *(unsigned long *)0,
+			(unsigned long)null_check);
                        ^^^^^^^^^^^^^^^
This cast is not needed, as null_check has the correct type.

BTW, what about writing it like

	unsigned long val;

	val = *(unsigned long *)0;
	if (val != null_check)
		printf("null check failed: %lx != %lx\n\r", val, null_check);

to kill a duplicate cast and avoid splitting the printf() line?

With kind regards,

Geert Uytterhoeven
Software Architect

Sony Network and Software Technology Center Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium

Phone:    +32 (0)2 700 8453
Fax:      +32 (0)2 700 8622
E-mail:   Geert.Uytterhoeven@sonycom.com
Internet: http://www.sony-europe.com/

Sony Network and Software Technology Center Europe
A division of Sony Service Centre (Europe) N.V.
Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium
VAT BE 0413.825.160 · RPR Brussels
Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help