diff options
author | Marek Vasut <marek.vasut+renesas@mailbox.org> | 2023-03-02 04:08:17 +0100 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2023-03-08 11:40:57 -0800 |
commit | 778c7ab5a7905dd984ce1fc743962c16b5bf3d82 (patch) | |
tree | 6ac7a4274bf881f3db486ed9f4ff90e1805e3778 | |
parent | 9597637f93632d4399f07cd0570a544edd55596a (diff) | |
download | u-boot-778c7ab5a7905dd984ce1fc743962c16b5bf3d82.zip u-boot-778c7ab5a7905dd984ce1fc743962c16b5bf3d82.tar.gz u-boot-778c7ab5a7905dd984ce1fc743962c16b5bf3d82.tar.bz2 |
cmd: fdt: Fix fdt rsvmem behavior on non-existent index and error message space
In case 'fdt rsvmem delete index' is passed a non-existent index, one
which does not exist in 'fdt rsvmem print', then the following command
triggers a print of help message for 'fdt' command instead of erroring
out:
=> fdt rsvmem delete 1234
This is because the subcommand errornously returns 'err' instead of
CMD_RET_FAILURE, fix it. Furthermore, align the number of spaces past
fdt_del_mem_rsv() and fdt_add_mem_rsv() in error message with the rest
of the code.
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
-rw-r--r-- | cmd/fdt.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -644,18 +644,18 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) err = fdt_add_mem_rsv(working_fdt, addr, size); if (err < 0) { - printf("libfdt fdt_add_mem_rsv(): %s\n", + printf("libfdt fdt_add_mem_rsv(): %s\n", fdt_strerror(err)); - return err; + return CMD_RET_FAILURE; } } else if (argv[2][0] == 'd') { unsigned long idx = hextoul(argv[3], NULL); int err = fdt_del_mem_rsv(working_fdt, idx); if (err < 0) { - printf("libfdt fdt_del_mem_rsv(): %s\n", + printf("libfdt fdt_del_mem_rsv(): %s\n", fdt_strerror(err)); - return err; + return CMD_RET_FAILURE; } } else { /* Unrecognized command */ |