diff options
author | Tom Rini <trini@konsulko.com> | 2017-01-14 12:16:43 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2017-01-14 12:16:43 -0500 |
commit | b7127e3c51db4cc3ebe470153452b66c1f0ff83e (patch) | |
tree | 95456ea05894b4743e883db529b09f0aa42bb26d | |
parent | 83c2f0b451f1656a25272357aa60f6887d5564df (diff) | |
parent | b05bf6c75d03c925737e228472b694cbeaa503c2 (diff) | |
download | u-boot-imx-b7127e3c51db4cc3ebe470153452b66c1f0ff83e.zip u-boot-imx-b7127e3c51db4cc3ebe470153452b66c1f0ff83e.tar.gz u-boot-imx-b7127e3c51db4cc3ebe470153452b66c1f0ff83e.tar.bz2 |
Merge git://git.denx.de/u-boot-fdt
-rw-r--r-- | cmd/fdt.c | 10 | ||||
-rw-r--r-- | lib/libfdt/fdt_overlay.c | 7 |
2 files changed, 13 insertions, 4 deletions
@@ -58,7 +58,7 @@ static int fdt_value_setenv(const void *nodep, int len, const char *var) else if (len == 4) { char buf[11]; - sprintf(buf, "0x%08X", *(uint32_t *)nodep); + sprintf(buf, "0x%08X", fdt32_to_cpu(*(fdt32_t *)nodep)); setenv(var, buf); } else if (len%4 == 0 && len <= 20) { /* Needed to print things like sha1 hashes. */ @@ -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 */ @@ -764,7 +768,7 @@ static int fdt_parse_prop(char * const *newval, int count, char *data, int *len) cp = newp; tmp = simple_strtoul(cp, &newp, 0); - *(__be32 *)data = __cpu_to_be32(tmp); + *(fdt32_t *)data = cpu_to_fdt32(tmp); data += 4; *len += 4; diff --git a/lib/libfdt/fdt_overlay.c b/lib/libfdt/fdt_overlay.c index bb41404..56cb70e 100644 --- a/lib/libfdt/fdt_overlay.c +++ b/lib/libfdt/fdt_overlay.c @@ -359,6 +359,9 @@ static int overlay_fixup_one_phandle(void *fdt, void *fdto, int symbol_off, fixup_off; int prop_len; + if (symbols_off < 0) + return symbols_off; + symbol_path = fdt_getprop(fdt, symbols_off, label, &prop_len); if (!symbol_path) @@ -492,7 +495,9 @@ static int overlay_fixup_phandles(void *fdt, void *fdto) /* We can have overlays without any fixups */ fixups_off = fdt_path_offset(fdto, "/__fixups__"); - if ((fixups_off < 0 && (fixups_off != -FDT_ERR_NOTFOUND))) + if (fixups_off == -FDT_ERR_NOTFOUND) + return 0; /* nothing to do */ + if (fixups_off < 0) return fixups_off; /* And base DTs without symbols */ |