[coreboot] [PATCH] fix compiler warning

Patrick Georgi patrick at georgi-clan.de
Sat Nov 13 09:45:37 CET 2010


Am 29.10.2010 07:58, schrieb Nathan Williams:
> Trivial fix to remove compiler warning
Thank you for the patch.
However, I think it has a risk of hiding real issues.
Right now, the only case where spd_byte is uninitialized is the "else"
clause, which runs into an endless loop (via hcf()). Your gcc version
doesn't seem to detect that for some reason.
Should the code change, and some other case leaves spd_byte untouched,
without coreboot giving up, we get a value of 0 instead of a compile
time error.

As I can't reproduce the warning (probably because my gcc version 4.4.4
detects that all cases either initialize spd_byte or never use it),
could you please test the following change instead (with your patch
reverted)?
This explicitely tells the compiler that hcf won't return, so it should
figure out that spd_byte is never used without being initialized even
without knowing that while(1) { no break statement } is an endless loop.


Thanks,
Patrick

Index: src/northbridge/amd/lx/raminit.c
===================================================================
--- src/northbridge/amd/lx/raminit.c    (Revision 6066)
+++ src/northbridge/amd/lx/raminit.c    (Arbeitskopie)
@@ -32,7 +32,7 @@
 	printk(BIOS_DEBUG, " * %s\n", s);
 }

-static void hcf(void)
+static void __attribute__((noreturn)) hcf(void)
 {
 	print_emerg("DIE\n");
 	/* this guarantees we flush the UART fifos (if any) and also




More information about the coreboot mailing list