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

login
register
mail settings
Submitter Simon Glass
Date Sept. 23, 2011, 4:22 p.m.
Message ID <1316794942-24709-19-git-send-email-sjg@chromium.org>
Download mbox | patch
Permalink /patch/116140/
State New, archived
Headers show

Comments

Simon Glass - Sept. 23, 2011, 4:22 p.m.
There are a few variables set but not used - this marks these as unused
for the compiler.

Signed-off-by: Simon Glass <sjg@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(-)

Patch

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';