[U-Boot] [PATCH] cmd_fuse: return CMD_RET_FAILURE on error

Benoît Thébaudeau benoit.thebaudeau.dev at gmail.com
Thu Nov 20 01:06:31 CET 2014


Dear Hector Palacios,

On Wed, Nov 19, 2014 at 4:52 PM, Hector Palacios
<hector.palacios at digi.com> wrote:
> 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.

> 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.

>
> Signed-off-by: Hector Palacios <hector.palacios at digi.com>
> ---
>  common/cmd_fuse.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/common/cmd_fuse.c b/common/cmd_fuse.c
> index abab9789b0df..d4bc0f6c94a1 100644
> --- a/common/cmd_fuse.c
> +++ b/common/cmd_fuse.c
> @@ -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.

>  }
>
>  U_BOOT_CMD(

Best regards,
Benoît


More information about the U-Boot mailing list