cmd: fdt: Print error message when fdt application fails
authorStefan Agner <stefan.agner@toradex.com>
Tue, 20 Dec 2016 14:58:45 +0000 (15:58 +0100)
committerSimon Glass <sjg@chromium.org>
Sat, 14 Jan 2017 01:19:45 +0000 (18:19 -0700)
There are lots of reason why a FDT application might fail, the
error code might give an indication. Let the error code translate
in a error string so users can try to understand what went wrong.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Simon Glass <sjg@chromium.org>
cmd/fdt.c

index 8bd345afa8a17c0cff355dcd6ea22fed98cfd60e..6883e754edf867e4d3e8cb2baf3cb1f2cfbfb584 100644 (file)
--- a/cmd/fdt.c
+++ b/cmd/fdt.c
@@ -642,6 +642,7 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
        else if (strncmp(argv[1], "ap", 2) == 0) {
                unsigned long addr;
                struct fdt_header *blob;
+               int ret;
 
                if (argc != 3)
                        return CMD_RET_USAGE;
@@ -654,8 +655,11 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                if (!fdt_valid(&blob))
                        return CMD_RET_FAILURE;
 
-               if (fdt_overlay_apply(working_fdt, blob))
+               ret = fdt_overlay_apply(working_fdt, blob);
+               if (ret) {
+                       printf("fdt_overlay_apply(): %s\n", fdt_strerror(ret));
                        return CMD_RET_FAILURE;
+               }
        }
 #endif
        /* resize the fdt */