[coreboot-gerrit] New patch to review for coreboot: nb/intel/i945/gma: Declare count variable outside 'for' loop

Paul Menzel (paulepanter@users.sourceforge.net) gerrit at coreboot.org
Sun Nov 27 22:22:51 CET 2016


Paul Menzel (paulepanter at users.sourceforge.net) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17623

-gerrit

commit 2150ab51f9e5ebd1f657e95ea3a11b7678c15be0
Author: Paul Menzel <paulepanter at users.sourceforge.net>
Date:   Sun Nov 27 22:17:44 2016 +0100

    nb/intel/i945/gma: Declare count variable outside 'for' loop
    
    Building an image for the Lenovo X60 on Debian 8.5 (jessie) with GCC 4.9.2,
    compilation fails with the error below.
    
    ```
    $ gcc --version
    gcc (Debian 4.9.2-10) 4.9.2
    […]
    $ make # lenovo/x60 with native graphics initialization
    […]
        CC         ramstage/northbridge/intel/i945/gma.o
    src/northbridge/intel/i945/gma.c: In function 'probe_edid':
    src/northbridge/intel/i945/gma.c:570:2: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
      for (int i = 0; i < 8; i++) {
      ^
    src/northbridge/intel/i945/gma.c:570:2: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code
    Makefile:316: recipe for target 'build/ramstage/northbridge/intel/i945/gma.o' failed
    make: *** [build/ramstage/northbridge/intel/i945/gma.o] Error 1
    ```
    
    Fix this by declaring the count variable outside the 'for' loop.
    
    Change-Id: Icf69337ee46c86bafc4e1320fd99f8f8f5155bfe
    Signed-off-by: Paul Menzel <paulepanter at users.sourceforge.net>
---
 src/northbridge/intel/i945/gma.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/northbridge/intel/i945/gma.c b/src/northbridge/intel/i945/gma.c
index e3ff478..b9a37e4 100644
--- a/src/northbridge/intel/i945/gma.c
+++ b/src/northbridge/intel/i945/gma.c
@@ -563,11 +563,12 @@ static int intel_gma_init_vga(struct northbridge_intel_i945_config *conf,
 /* if vga is not connected it should have a correct header */
 static int probe_edid(u8 *pmmio, u8 slave)
 {
+	int i;
 	u8 vga_edid[128];
 	u8 header[8] = {0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00};
 	intel_gmbus_read_edid(pmmio + GMBUS0, slave, 0x50, vga_edid, 128);
 	intel_gmbus_stop(pmmio + GMBUS0);
-	for (int i = 0; i < 8; i++) {
+	for (i = 0; i < 8; i++) {
 		if (vga_edid[i] != header[i]) {
 			printk(BIOS_DEBUG, "No display connected on slave %d\n",
 				slave);



More information about the coreboot-gerrit mailing list