]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
cmd: fdt: Fix fdt rm behavior on non-existent property and error message space
authorMarek Vasut <marek.vasut+renesas@mailbox.org>
Thu, 2 Mar 2023 03:08:16 +0000 (04:08 +0100)
committerSimon Glass <sjg@chromium.org>
Thu, 9 Mar 2023 16:50:47 +0000 (08:50 -0800)
In case an FDT contains a node '/test-node@1234' , with no property
called 'noprop' in that node, the following command triggers a print
of help message for 'fdt' command instead of erroring out:
=> fdt rm /test-node@1234 noprop
This is because the subcommand errornously returns 'err' instead of
CMD_RET_FAILURE, fix it. Furthermore, align the number of spaces past
fdt_delprop() 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>
cmd/fdt.c

index 56b3585c3ac59201d00beb67dee4d6edb46b291d..644b58ac4d76d002b76176ab73d1bc6549359588 100644 (file)
--- a/cmd/fdt.c
+++ b/cmd/fdt.c
@@ -547,16 +547,16 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
                if (argc > 3) {
                        err = fdt_delprop(working_fdt, nodeoffset, argv[3]);
                        if (err < 0) {
-                               printf("libfdt fdt_delprop():  %s\n",
+                               printf("libfdt fdt_delprop(): %s\n",
                                        fdt_strerror(err));
-                               return err;
+                               return CMD_RET_FAILURE;
                        }
                } else {
                        err = fdt_del_node(working_fdt, nodeoffset);
                        if (err < 0) {
-                               printf("libfdt fdt_del_node():  %s\n",
+                               printf("libfdt fdt_del_node(): %s\n",
                                        fdt_strerror(err));
-                               return err;
+                               return CMD_RET_FAILURE;
                        }
                }