[U-Boot] [RFC PATCH v2 18/20] Remove unused variable warnings in cmd_mem, cmd_nvedit

Simon Glass sjg at chromium.org
Fri Sep 23 18:22:20 CEST 2011


There are a few variables set but not used - this marks these as unused
for the compiler.

Signed-off-by: Simon Glass <sjg at chromium.org>
---
Changes in v2:
- Try to avoid needing __attribute__((unused)) by assigning to an existing var

 common/cmd_mem.c    |    8 ++++----
 common/cmd_nvedit.c |    3 +--
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/common/cmd_mem.c b/common/cmd_mem.c
index 4daa1b3..d6965e2 100644
--- a/common/cmd_mem.c
+++ b/common/cmd_mem.c
@@ -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++;
+				size = *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++;
+				size = *shortp++;
 		}
 	}
 	for (;;) {
 		cp = (u_char *)addr;
 		i = length;
 		while (i-- > 0)
-			junk = *cp++;
+			size = *cp++;
 	}
 }
 
diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index e8b116d..101bc49 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -460,7 +460,6 @@ int do_env_edit(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	char buffer[CONFIG_SYS_CBSIZE];
 	char *init_val;
-	int len;
 
 	if (argc < 2)
 		return cmd_usage(cmdtp);
@@ -468,7 +467,7 @@ int do_env_edit(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	/* Set read buffer to initial value or empty sting */
 	init_val = getenv(argv[1]);
 	if (init_val)
-		len = sprintf(buffer, "%s", init_val);
+		sprintf(buffer, "%s", init_val);
 	else
 		buffer[0] = '\0';
 
-- 
1.7.3.1



More information about the U-Boot mailing list