diff mbox series

[1/1] cmd: load, emit error message for invalid block device

Message ID 20210127202643.91231-1-xypron.glpk@gmx.de
State Accepted
Commit ec9d19be8d6cabc820e133bb36a1386adcf0b3d1
Delegated to: Tom Rini
Headers show
Series [1/1] cmd: load, emit error message for invalid block device | expand

Commit Message

Heinrich Schuchardt Jan. 27, 2021, 8:26 p.m. UTC
The load command should not silently return to the console prompt if an
invalid block device is specified and no file is loaded.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 fs/fs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--
2.29.2

Comments

Simon Glass Jan. 28, 2021, 2:12 p.m. UTC | #1
On Wed, 27 Jan 2021 at 13:26, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>
> The load command should not silently return to the console prompt if an
> invalid block device is specified and no file is loaded.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
>  fs/fs.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>

Reviewed-by: Simon Glass <sjg@chromium.org>
Tom Rini Feb. 2, 2021, 2:31 p.m. UTC | #2
On Wed, Jan 27, 2021 at 09:26:43PM +0100, Heinrich Schuchardt wrote:

> The load command should not silently return to the console prompt if an
> invalid block device is specified and no file is loaded.
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/fs/fs.c b/fs/fs.c
index 68a15553cc..0c8f577a79 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -710,8 +710,10 @@  int do_load(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[],
 	if (argc > 7)
 		return CMD_RET_USAGE;

-	if (fs_set_blk_dev(argv[1], (argc >= 3) ? argv[2] : NULL, fstype))
+	if (fs_set_blk_dev(argv[1], (argc >= 3) ? argv[2] : NULL, fstype)) {
+		log_err("Can't set block device\n");
 		return 1;
+	}

 	if (argc >= 4) {
 		addr = simple_strtoul(argv[3], &ep, 16);