From 04cc6f0a53a64c9ea3645c8538a27c8ceded1a6c Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Thu, 1 Jun 2023 13:21:07 +0200 Subject: [PATCH] arm64: zynqmp: Fix command error values properly Process errors from command via cmd_process_error() as is done on Versal. When internal function returns different number then CMD_RET_SUCCESS(0), CMD_RET_FAILURE(1) or CMD_RET_USAGE(-1) shell react on these errors by throwing an error like "exit not allowed from main input shell." that's why use cmd_process_error() to make sure that error code is all the time correct. Signed-off-by: Michal Simek Link: https://lore.kernel.org/r/d511935ba10daf95c70996fae6e6ffc374efffa0.1685618464.git.michal.simek@amd.com --- board/xilinx/zynqmp/cmds.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/board/xilinx/zynqmp/cmds.c b/board/xilinx/zynqmp/cmds.c index c1224bdf82..9d375b0755 100644 --- a/board/xilinx/zynqmp/cmds.c +++ b/board/xilinx/zynqmp/cmds.c @@ -394,17 +394,17 @@ static int do_zynqmp(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { struct cmd_tbl *c; + int ret = CMD_RET_USAGE; if (argc < 2) return CMD_RET_USAGE; c = find_cmd_tbl(argv[1], &cmd_zynqmp_sub[0], ARRAY_SIZE(cmd_zynqmp_sub)); - if (c) - return c->cmd(c, flag, argc, argv); - else - return CMD_RET_USAGE; + ret = c->cmd(c, flag, argc, argv); + + return cmd_process_error(c, ret); } /***************************************************/ -- 2.39.5