cmd_fuse: return CMD_RET_FAILURE on error
PATCH 1/1 cmd_fuse: return CMD_RET_FAILURE on error
Fuse drivers, like the mxs_ocotp.c, may return negative error codes but the commands are not allowed to return negative error codes to the shell, otherwise the following error appears:
"exit not allowed from main input shell."
--- common/cmd_fuse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
common/cmd_fuse.c +1 -1
@@ -128,7 +128,7 @@ static int do_fuse(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) err:puts ("ERROR\n" ); -return ret; +return CMD_RET_FAILURE ; } U_BOOT_CMD(
PATCH 1/1 cmd_fuse: return CMD_RET_FAILURE on error
Dear Hector Palacios,
Quoted 2 lines · Hector Palacios
Fuse drivers, like the
mxs_ocotp.c, may return negative error codes but the commands are not allowed to return negative error codes to the shell,
Correct, except -1 for CMD_RET_USAGE.
Quoted 3 lines
otherwise the following error appears:
"exit not allowed from main input shell."
Not for any negative error.
The change is correct, but maybe the commit message should be reworded to be more precise. You could perhaps just say that this error message may appear because of unsupported return codes, and that only the CMD_RET_* enum values should be used as command return values.
Quoted 11 lines
Signed-off-by Hector Palacios <[email protected]>--- common/cmd_fuse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)common/cmd_fuse.c +0
-0
common/cmd_fuse.c static int do_fuse(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) · line 131
Quoted 5 lines
common/cmd_fuse.c +1
-1@@ -128,7 +128,7 @@ static int do_fuse(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) err:puts ("ERROR\n" ); -return ret; +return CMD_RET_FAILURE ;
Correct. BTW, you could perhaps replace the 'return 0;' above 'err:' with 'return CMD_RET_SUCCESS;' as a cosmetic change enforcing the use of CMD_RET_* values.
common/cmd_fuse.c static int do_fuse(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) · line 134
Quoted 3 lines
common/cmd_fuse.c +0
-0} U_BOOT_CMD(
Best regards,
Beno?t