[U-Boot] [PATCH 3/4] cmd: mtd: Don't use with negative return codes for shell commands
Stefan Roese
sr at denx.de
Tue Aug 7 05:07:44 UTC 2018
Hi Boris,
On 06.08.2018 22:38, Boris Brezillon wrote:
> 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?
Good idea, thanks. Will change in v2.
Thanks,
Stefan
More information about the U-Boot
mailing list