sandbox: Update do_host_bind() argument counting
Remove the 'bind' subcommand before processing the arguments. This will make it easier to add an optional flag. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
1503c2c790
commit
803e9c1c94
|
@ -46,15 +46,18 @@ static int do_host_bind(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||||
char *ep;
|
char *ep;
|
||||||
int dev;
|
int dev;
|
||||||
|
|
||||||
if (argc < 2 || argc > 3)
|
/* Skip 'bind' */
|
||||||
|
argc--;
|
||||||
|
argv++;
|
||||||
|
if (argc < 1 || argv > 2)
|
||||||
return CMD_RET_USAGE;
|
return CMD_RET_USAGE;
|
||||||
dev_str = argv[1];
|
dev_str = argv[0];
|
||||||
dev = simple_strtoul(dev_str, &ep, 16);
|
dev = simple_strtoul(dev_str, &ep, 16);
|
||||||
if (*ep) {
|
if (*ep) {
|
||||||
printf("** Bad device specification %s **\n", dev_str);
|
printf("** Bad device specification %s **\n", dev_str);
|
||||||
return CMD_RET_USAGE;
|
return CMD_RET_USAGE;
|
||||||
}
|
}
|
||||||
file = argc >= 3 ? argv[2] : NULL;
|
file = argc > 1 ? argv[1] : NULL;
|
||||||
|
|
||||||
return !!host_dev_bind(dev, file);
|
return !!host_dev_bind(dev, file);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue