Patchwork [U-Boot,2/5] GCC4,6: Squash warning in cmd_nand.c

login
register
mail settings
Submitter Marek Vasut
Date Sept. 30, 2011, 10:13 a.m.
Message ID <1317377606-9830-2-git-send-email-marek.vasut@gmail.com>
Download mbox | patch
Permalink /patch/117071/
State Accepted
Headers show

Comments

Marek Vasut - Sept. 30, 2011, 10:13 a.m.
cmd_nand.c: In function ‘do_nand’:
cmd_nand.c:490:7: warning: variable ‘chip’ set but not used
[-Wunused-but-set-variable]
cmd_nand.c:489:7: warning: variable ‘part’ set but not used
[-Wunused-but-set-variable]

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Scott Wood <scottwood@freescale.com>
---
 common/cmd_nand.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)
Marek Vasut - Sept. 30, 2011, 10:14 a.m.
On Friday, September 30, 2011 12:13:23 PM Marek Vasut wrote:
> cmd_nand.c: In function ‘do_nand’:
> cmd_nand.c:490:7: warning: variable ‘chip’ set but not used
> [-Wunused-but-set-variable]
> cmd_nand.c:489:7: warning: variable ‘part’ set but not used
> [-Wunused-but-set-variable]
> 
> Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
> Cc: Scott Wood <scottwood@freescale.com>
> ---
>  common/cmd_nand.c |    4 ----
>  1 files changed, 0 insertions(+), 4 deletions(-)
> 

This even looks like .part and .chip has no effect at all ... am I right ?
Mike Frysinger - Sept. 30, 2011, 3:57 p.m.
Acked-by: Mike Frysinger <vapier@gentoo.org>
-mike
Wolfgang Denk - Oct. 1, 2011, 9:31 p.m.
Dear Marek Vasut,

In message <1317377606-9830-2-git-send-email-marek.vasut@gmail.com> you wrote:
> cmd_nand.c: In function `do_nand´:
> cmd_nand.c:490:7: warning: variable `chip´ set but not used
> [-Wunused-but-set-variable]
> cmd_nand.c:489:7: warning: variable `part´ set but not used
> [-Wunused-but-set-variable]
> 
> Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
> Cc: Scott Wood <scottwood@freescale.com>
> ---
>  common/cmd_nand.c |    4 ----
>  1 files changed, 0 insertions(+), 4 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk
Scott Wood - Oct. 3, 2011, 4:22 p.m.
On 09/30/2011 05:14 AM, Marek Vasut wrote:
> On Friday, September 30, 2011 12:13:23 PM Marek Vasut wrote:
>> cmd_nand.c: In function ‘do_nand’:
>> cmd_nand.c:490:7: warning: variable ‘chip’ set but not used
>> [-Wunused-but-set-variable]
>> cmd_nand.c:489:7: warning: variable ‘part’ set but not used
>> [-Wunused-but-set-variable]
>>
>> Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
>> Cc: Scott Wood <scottwood@freescale.com>
>> ---
>>  common/cmd_nand.c |    4 ----
>>  1 files changed, 0 insertions(+), 4 deletions(-)
>>
> 
> This even looks like .part and .chip has no effect at all ... am I right ?

They affect error checking.  Beyond that, the code can tell what to do
from the number of arguments.  The idea was that accidentally leaving
out an argument (such as by a misspelled $varaible) shouldn't end up
erasing more than you expected.

-Scott

Patch

diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index f42ea5b..3e12a36 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -486,8 +486,6 @@  int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 		int scrub_yes = argc > 2 && !strcmp("-y", argv[2]);
 		int o = (clean || scrub_yes) ? 3 : 2;
 		int scrub = !strncmp(cmd, "scrub", 5);
-		int part = 0;
-		int chip = 0;
 		int spread = 0;
 		int args = 2;
 		const char *scrub_warn =
@@ -505,10 +503,8 @@  int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 			if (!strcmp(&cmd[5], ".spread")) {
 				spread = 1;
 			} else if (!strcmp(&cmd[5], ".part")) {
-				part = 1;
 				args = 1;
 			} else if (!strcmp(&cmd[5], ".chip")) {
-				chip = 1;
 				args = 0;
 			} else {
 				goto usage;