qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] Fix gcc-4.6 compiler error


From: Stefan Weil
Subject: [Qemu-devel] [PATCH] Fix gcc-4.6 compiler error
Date: Fri, 29 Jul 2011 21:30:24 +0200

Commit 3d3b8303c6f83b9b245bc774af530a6403cc4ce6
breaks builds with gcc-4.6:

hw/fw_cfg.c: In function ‘probe_splashfile’:
hw/fw_cfg.c:66:9: error: variable ‘fop_ret’ set but not used 
[-Werror=unused-but-set-variable]
hw/fw_cfg.c: In function ‘fw_cfg_bootsplash’:
hw/fw_cfg.c:130:9: error: variable ‘fop_ret’ set but not used 
[-Werror=unused-but-set-variable]

Remove fop_ret. Testing the result of fread() is normally
a good idea, but I don't think it is needed here.

Cc: Wayne Xia <address@hidden>
Cc: Anthony Liguori <address@hidden>
Signed-off-by: Stefan Weil <address@hidden>
---
 hw/fw_cfg.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/hw/fw_cfg.c b/hw/fw_cfg.c
index a29db90..d906b83 100644
--- a/hw/fw_cfg.c
+++ b/hw/fw_cfg.c
@@ -63,7 +63,6 @@ struct FWCfgState {
 static FILE *probe_splashfile(char *filename, int *file_sizep, int *file_typep)
 {
     FILE *fp = NULL;
-    int fop_ret;
     int file_size;
     int file_type = -1;
     unsigned char buf[2] = {0, 0};
@@ -86,7 +85,7 @@ static FILE *probe_splashfile(char *filename, int 
*file_sizep, int *file_typep)
     }
     /* check magic ID */
     fseek(fp, 0L, SEEK_SET);
-    fop_ret = fread(buf, 1, 2, fp);
+    (void)fread(buf, 1, 2, fp);
     filehead_value = (buf[0] + (buf[1] << 8)) & 0xffff;
     if (filehead_value == 0xd8ff) {
         file_type = JPG_FILE;
@@ -105,7 +104,7 @@ static FILE *probe_splashfile(char *filename, int 
*file_sizep, int *file_typep)
     /* check BMP bpp */
     if (file_type == BMP_FILE) {
         fseek(fp, 28, SEEK_SET);
-        fop_ret = fread(buf, 1, 2, fp);
+        (void)fread(buf, 1, 2, fp);
         bmp_bpp = (buf[0] + (buf[1] << 8)) & 0xffff;
         if (bmp_bpp != 24) {
             error_report("only 24bpp bmp file is supported.");
@@ -127,7 +126,6 @@ static void fw_cfg_bootsplash(FWCfgState *s)
     char *p;
     char *filename;
     FILE *fp;
-    int fop_ret;
     int file_size;
     int file_type = -1;
     const char *temp;
@@ -180,7 +178,7 @@ static void fw_cfg_bootsplash(FWCfgState *s)
         boot_splash_filedata = qemu_malloc(file_size);
         boot_splash_filedata_size = file_size;
         fseek(fp, 0L, SEEK_SET);
-        fop_ret = fread(boot_splash_filedata, 1, file_size, fp);
+        (void)fread(boot_splash_filedata, 1, file_size, fp);
         fclose(fp);
         /* insert data */
         if (file_type == JPG_FILE) {
-- 
1.7.2.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]