[PATCH 4/4] cmd: mvebu/bubt: Fix cmd main return value on error

Stefan Roese sr at denx.de
Thu Jul 28 08:38:22 CEST 2022


On 26.07.22 16:11, Pali Rohár wrote:
> Negative return value from cmd main function cause U-Boot to print criplic
> error message: exit not allowed from main input shell.
> 
> Set return value on error to 1.
> 
> Signed-off-by: Pali Rohár <pali at kernel.org>

Reviewed-by: Stefan Roese <sr at denx.de>

Thanks,
Stefan

> ---
>   cmd/mvebu/bubt.c | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c
> index 276069a0efc2..ffa05bc20181 100644
> --- a/cmd/mvebu/bubt.c
> +++ b/cmd/mvebu/bubt.c
> @@ -870,11 +870,11 @@ int do_bubt_cmd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
>   	dst = find_bubt_dev(dst_dev_name);
>   	if (!dst) {
>   		printf("Error: Unknown destination \"%s\"\n", dst_dev_name);
> -		return -EINVAL;
> +		return 1;
>   	}
>   
>   	if (!bubt_is_dev_active(dst))
> -		return -ENODEV;
> +		return 1;
>   
>   	/* Figure out the source device */
>   	src = find_bubt_dev(src_dev_name);
> @@ -891,15 +891,15 @@ int do_bubt_cmd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
>   
>   	image_size = bubt_read_file(src);
>   	if (!image_size)
> -		return -EIO;
> +		return 1;
>   
>   	err = bubt_verify(dst);
>   	if (err)
> -		return err;
> +		return 1;
>   
>   	err = bubt_write_file(dst, image_size);
>   	if (err)
> -		return err;
> +		return 1;
>   
>   	return 0;
>   }

Viele Grüße,
Stefan Roese

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de


More information about the U-Boot mailing list