GCC4.6: Squash warning in cmd_mem.c
authorMarek Vasut <marek.vasut@gmail.com>
Mon, 26 Sep 2011 00:26:06 +0000 (02:26 +0200)
committerWolfgang Denk <wd@denx.de>
Sat, 1 Oct 2011 21:26:36 +0000 (23:26 +0200)
cmd_mem.c: In function ‘do_mem_loop’:
cmd_mem.c:474:25: warning: variable ‘junk’ set but not used
[-Wunused-but-set-variable]

The assigned variable can be removed because the pointers are volatile so
accesses to their addresses are always generated.

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
common/cmd_mem.c

index 4daa1b3db0032ce16e80cefd94dc4a923260efe1..e84cc4e22d3ee7ccbf0f95aab84d6c2e3cd56f7d 100644 (file)
@@ -471,7 +471,7 @@ int do_mem_base (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 int do_mem_loop (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
-       ulong   addr, length, i, junk;
+       ulong   addr, length, i;
        int     size;
        volatile uint   *longp;
        volatile ushort *shortp;
@@ -518,7 +518,7 @@ int do_mem_loop (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                        longp = (uint *)addr;
                        i = length;
                        while (i-- > 0)
-                               junk = *longp++;
+                               *longp++;
                }
        }
        if (size == 2) {
@@ -526,14 +526,14 @@ int do_mem_loop (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                        shortp = (ushort *)addr;
                        i = length;
                        while (i-- > 0)
-                               junk = *shortp++;
+                               *shortp++;
                }
        }
        for (;;) {
                cp = (u_char *)addr;
                i = length;
                while (i-- > 0)
-                       junk = *cp++;
+                       *cp++;
        }
 }