nand command: check for <dev> directly after option parsing
Allo subcommands need at least one nonopt arg, so check for it right after parsing the options and drop the check in the MARKBAD command. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
938f748103
commit
68bd6e9309
|
@ -58,6 +58,9 @@ static int do_nand(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
if (optind >= argc)
|
||||
return COMMAND_ERROR_USAGE;
|
||||
|
||||
if (command == NAND_ADD) {
|
||||
while (optind < argc) {
|
||||
if (dev_add_bb_dev(basename(argv[optind]), NULL))
|
||||
|
@ -75,7 +78,6 @@ static int do_nand(int argc, char *argv[])
|
|||
}
|
||||
|
||||
if (command == NAND_MARKBAD) {
|
||||
if (optind < argc) {
|
||||
int ret = 0, fd;
|
||||
|
||||
printf("marking block at 0x%08llx on %s as bad\n",
|
||||
|
@ -94,7 +96,6 @@ static int do_nand(int argc, char *argv[])
|
|||
close(fd);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue