aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Vasut <marek.vasut@gmail.com>2020-09-12 12:42:52 +0200
committerTom Rini <trini@konsulko.com>2020-09-16 16:54:00 -0400
commit81d0cef3b268ccc4f1061a3e29850fbd23166d20 (patch)
treed066c5a91273a63c908b14b177c9d568072fe83d
parent7def4e621b7c65b4a3740a554dcbc807e23b1c19 (diff)
downloadu-boot-81d0cef3b268ccc4f1061a3e29850fbd23166d20.zip
u-boot-81d0cef3b268ccc4f1061a3e29850fbd23166d20.tar.gz
u-boot-81d0cef3b268ccc4f1061a3e29850fbd23166d20.tar.bz2
lib: fdt: Fix fdtdec_setup_mem..() conversion to livetree API
Repair incorrectly negated condition in the original patch which broke DT memory node parsing on everything which has more than one DT memory node, e.g. R-Car3. In case multiple valid memory nodes are present in the DT, the original patch would complete parsing cycle for the first memory node, then move on to the next one, identify it as a valid, and end the parsing. The fix is to invert the condition, to make the code behave as it did before the livetree conversion, so it would continue parsing the subsequent memory nodes as well. Fixes: c2f0950c33 ("lib: fdt: Convert fdtdes_setup_mem..() to livetree API") Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Michal Simek <michal.simek@xilinx.com> Cc: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@konsulko.com> Tested-by: Biju Das <biju.das.jz@bp.renesas.com> Reviewed-by: Michal Simek <michal.simek@xilinx.com>
-rw-r--r--lib/fdtdec.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index d3b22ec..5f41f58 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -1101,7 +1101,7 @@ int fdtdec_setup_memory_banksize(void)
if (ret < 0) {
reg = 0;
mem = get_next_memory_node(mem);
- if (ofnode_valid(mem))
+ if (!ofnode_valid(mem))
break;
ret = ofnode_read_resource(mem, reg++, &res);
@@ -1146,7 +1146,7 @@ int fdtdec_setup_mem_size_base_lowest(void)
if (ret < 0) {
reg = 0;
mem = get_next_memory_node(mem);
- if (ofnode_valid(mem))
+ if (!ofnode_valid(mem))
break;
ret = ofnode_read_resource(mem, reg++, &res);