summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-03-15 08:11:10 +0300
committerSimon Glass <sjg@chromium.org>2021-03-27 05:04:31 +0300
commit803e9c1c94d06cfab43606056c653268e12926d8 (patch)
treeb349f3c8d38d1fc8230af1f3b45837ef0dba4b52 /cmd
parent1503c2c7906d191e24579246fc3a6fcd656a890b (diff)
downloadu-boot-803e9c1c94d06cfab43606056c653268e12926d8.tar.xz
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>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/host.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/cmd/host.c b/cmd/host.c
index 927c23d0d9..847bb1d3b5 100644
--- a/cmd/host.c
+++ b/cmd/host.c
@@ -46,15 +46,18 @@ static int do_host_bind(struct cmd_tbl *cmdtp, int flag, int argc,
char *ep;
int dev;
- if (argc < 2 || argc > 3)
+ /* Skip 'bind' */
+ argc--;
+ argv++;
+ if (argc < 1 || argv > 2)
return CMD_RET_USAGE;
- dev_str = argv[1];
+ dev_str = argv[0];
dev = simple_strtoul(dev_str, &ep, 16);
if (*ep) {
printf("** Bad device specification %s **\n", dev_str);
return CMD_RET_USAGE;
}
- file = argc >= 3 ? argv[2] : NULL;
+ file = argc > 1 ? argv[1] : NULL;
return !!host_dev_bind(dev, file);
}