Patchwork fix compiler warning

Submitter Patrick Georgi
Date 2010-11-13 08:45:37
Message ID <>
Download mbox | patch
Permalink /patch/2316/
State Accepted
Headers show


Patrick Georgi - 2010-11-13 08:45:37
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
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.



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)
 	/* this guarantees we flush the UART fifos (if any) and also