[PATCH] cmd: host: return value of do_host_bind()

Heinrich Schuchardt xypron.glpk at gmx.de
Fri Jul 24 08:29:55 CEST 2020


When trying to bind to a non-existent file the following output is
displayed:

=> host bind 0 non_existent
Failed to access host backing file 'non_existent'
exit not allowed from main input shell.

The last line is quite unexpected and due to an incorrect return value.

If do_host_bind() fails, return CMD_RET_FAILURE (= 1).

Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
---
 cmd/host.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmd/host.c b/cmd/host.c
index cd9c9677f0..780a087654 100644
--- a/cmd/host.c
+++ b/cmd/host.c
@@ -51,7 +51,7 @@ static int do_host_bind(struct cmd_tbl *cmdtp, int flag, int argc,
 		printf("** Bad device specification %s **\n", dev_str);
 		return CMD_RET_USAGE;
 	}
-	return host_dev_bind(dev, file);
+	return !!host_dev_bind(dev, file);
 }

 static int do_host_info(struct cmd_tbl *cmdtp, int flag, int argc,
--
2.26.2



More information about the U-Boot mailing list