[U-Boot] [PATCH 3/4] cmd: mtd: Don't use with negative return codes for shell commands

Boris Brezillon boris.brezillon at bootlin.com
Mon Aug 6 20:38:56 UTC 2018


On Mon,  6 Aug 2018 17:12:52 +0200
Stefan Roese <sr at denx.de> wrote:

> When negative return codes are used in commands (do_foo()), the shell
> prints these messages:
> 
> exit not allowed from main input shell.
> 
> Change the return codes in the new mtd commands to use only positive
> values and these annoying warnings are gone.
> 
> Signed-off-by: Stefan Roese <sr at denx.de>
> Cc: Miquel Raynal <miquel.raynal at bootlin.com>
> Cc: Boris Brezillon <boris.brezillon at bootlin.com>
> Cc: Jagan Teki <jagan at openedev.com>
> ---
>  cmd/mtd.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/cmd/mtd.c b/cmd/mtd.c
> index 221b12500f..38a89736cf 100644
> --- a/cmd/mtd.c
> +++ b/cmd/mtd.c
> @@ -188,7 +188,7 @@ static int do_mtd_list(void)
>  
>  	if (!dev_nb) {
>  		printf("No MTD device found\n");
> -		return -EINVAL;
> +		return EINVAL;

How about using CMD_RET_FAILURE for all errors?


More information about the U-Boot mailing list