aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorBin Meng <bmeng@tinylab.org>2023-09-26 16:43:32 +0800
committerTom Rini <trini@konsulko.com>2023-10-10 16:19:29 -0400
commit77ca9d74571e92969591d39df134ccd72296f4d9 (patch)
tree8d711647280c41b8d04aaf11c2dbf5bb29bee3f9 /cmd
parent7020b2eca49e2c902bb443273ba21df2050d7f1e (diff)
downloadu-boot-77ca9d74571e92969591d39df134ccd72296f4d9.zip
u-boot-77ca9d74571e92969591d39df134ccd72296f4d9.tar.gz
u-boot-77ca9d74571e92969591d39df134ccd72296f4d9.tar.bz2
cmd: host: Mandate the filename parameter in the 'bind' command
At present the host bind command does not require filename to be provided. When it is not given NULL is passed to the host device driver, which ends up failure afterwards. Change to mandate the filename so that it is useful. Signed-off-by: Bin Meng <bmeng@tinylab.org> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/host.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/cmd/host.c b/cmd/host.c
index fb1cb1f..b924940 100644
--- a/cmd/host.c
+++ b/cmd/host.c
@@ -59,10 +59,10 @@ static int do_host_bind(struct cmd_tbl *cmdtp, int flag, int argc,
argv++;
}
- if (argc > 2)
+ if (argc != 2)
return CMD_RET_USAGE;
label = argv[0];
- file = argc > 1 ? argv[1] : NULL;
+ file = argv[1];
ret = host_create_attach_file(label, file, removable, &dev);
if (ret) {
@@ -253,7 +253,7 @@ U_BOOT_CMD(
"host save hostfs - <addr> <filename> <bytes> [<offset>] - "
"save a file to host\n"
"host size hostfs - <filename> - determine size of file on host\n"
- "host bind [-r] <label> [<filename>] - bind \"host\" device to file\n"
+ "host bind [-r] <label> <filename> - bind \"host\" device to file\n"
" -r = mark as removable\n"
"host unbind <label> - unbind file from \"host\" device\n"
"host info [<label>] - show device binding & info\n"