Patchwork : avoid mcp55_early_setup_car.c compile failure when gcc 4.5.0 is used

login
register
about
Submitter Scott
Date 2010-10-26 04:49:30
Message ID <62B11813D8044FAF8F1D9C232F85EB89@m3a78>
Download mbox | patch
Permalink /patch/2168/
State Accepted
Commit r5988
Headers show

Comments

Scott - 2010-10-26 04:49:30
Hello,

When gcc 4.5.0 is used, compiling mcp55_early_setup_car.c fails:

$ make
which: svnversion: unknown command
which: git: unknown command
    GEN        build.h
    CC         romstage.inc
cc1.exe: warnings being treated as errors
src/mainboard/gigabyte/m57sli/romstage.c: In function 'cache_as_ram_main':
src/southbridge/nvidia/mcp55/mcp55_early_setup_car.c:366:11: error: 'busn[0u]' may be used uninitialized in this function
src/southbridge/nvidia/mcp55/mcp55_early_setup_car.c:366:11: note: 'busn[0u]' was declared here
src/southbridge/nvidia/mcp55/mcp55_early_setup_car.c:367:11: error: 'devn[0u]' may be used uninitialized in this function
src/southbridge/nvidia/mcp55/mcp55_early_setup_car.c:367:11: note: 'devn[0u]' was declared here
src/southbridge/nvidia/mcp55/mcp55_early_setup_car.c:368:11: error: 'io_base[0u]' may be used uninitialized in this function
src/southbridge/nvidia/mcp55/mcp55_early_setup_car.c:368:11: note: 'io_base[0u]' was declared here
make: *** [build/mainboard/gigabyte/m57sli/romstage.pre.inc] Error 1


This is the only failure from abuild with gcc 4.5.0. Should we play
along (at the expense of a few extra bytes of code generation)? If so:

Signed-off-by: Scott Duplichan <scott@notabs.org>
Index: src/southbridge/nvidia/mcp55/mcp55_early_setup_car.c
===================================================================
--- src/southbridge/nvidia/mcp55/mcp55_early_setup_car.c	(revision 5987)
+++ src/southbridge/nvidia/mcp55/mcp55_early_setup_car.c	(working copy)
@@ -363,9 +363,9 @@
 static int mcp55_early_setup_x(void)
 {
 	/*find out how many mcp55 we have */
-	unsigned busn[HT_CHAIN_NUM_MAX];
-	unsigned devn[HT_CHAIN_NUM_MAX];
-	unsigned io_base[HT_CHAIN_NUM_MAX];
+	unsigned busn[HT_CHAIN_NUM_MAX] = {0};
+	unsigned devn[HT_CHAIN_NUM_MAX] = {0};
+	unsigned io_base[HT_CHAIN_NUM_MAX] = {0};
 	/*
 		FIXME: May have problem if there is different MCP55 HTX card with different PCI_E lane allocation
 		Need to use same trick about pci1234 to verify node/link connection
Peter Stuge - 2010-10-26 04:57:53
Scott Duplichan wrote:
> Hello,
> 
> When gcc 4.5.0 is used, compiling mcp55_early_setup_car.c fails:
> 
> $ make
> which: svnversion: unknown command
> which: git: unknown command
>     GEN        build.h
>     CC         romstage.inc
> cc1.exe: warnings being treated as errors
> src/mainboard/gigabyte/m57sli/romstage.c: In function 'cache_as_ram_main':
> src/southbridge/nvidia/mcp55/mcp55_early_setup_car.c:366:11: error: 'busn[0u]' may be used uninitialized in this function
> src/southbridge/nvidia/mcp55/mcp55_early_setup_car.c:366:11: note: 'busn[0u]' was declared here
> src/southbridge/nvidia/mcp55/mcp55_early_setup_car.c:367:11: error: 'devn[0u]' may be used uninitialized in this function
> src/southbridge/nvidia/mcp55/mcp55_early_setup_car.c:367:11: note: 'devn[0u]' was declared here
> src/southbridge/nvidia/mcp55/mcp55_early_setup_car.c:368:11: error: 'io_base[0u]' may be used uninitialized in this function
> src/southbridge/nvidia/mcp55/mcp55_early_setup_car.c:368:11: note: 'io_base[0u]' was declared here
> make: *** [build/mainboard/gigabyte/m57sli/romstage.pre.inc] Error 1
> 
> 
> This is the only failure from abuild with gcc 4.5.0. Should we play
> along (at the expense of a few extra bytes of code generation)? If so:
> 
> Signed-off-by: Scott Duplichan <scott@notabs.org>

Acked-by: Peter Stuge <peter@stuge.se>

Patch

Index: src/southbridge/nvidia/mcp55/mcp55_early_setup_car.c
===================================================================
--- src/southbridge/nvidia/mcp55/mcp55_early_setup_car.c	(revision 5987)
+++ src/southbridge/nvidia/mcp55/mcp55_early_setup_car.c	(working copy)
@@ -363,9 +363,9 @@ 
 static int mcp55_early_setup_x(void)
 {
 	/*find out how many mcp55 we have */
-	unsigned busn[HT_CHAIN_NUM_MAX];
-	unsigned devn[HT_CHAIN_NUM_MAX];
-	unsigned io_base[HT_CHAIN_NUM_MAX];
+	unsigned busn[HT_CHAIN_NUM_MAX] = {0};
+	unsigned devn[HT_CHAIN_NUM_MAX] = {0};
+	unsigned io_base[HT_CHAIN_NUM_MAX] = {0};
 	/*
 		FIXME: May have problem if there is different MCP55 HTX card with different PCI_E lane allocation
 		Need to use same trick about pci1234 to verify node/link connection