From: Tom Rini Date: Tue, 15 Sep 2020 10:01:48 -0400 Subject: [PATCH] lib: fdt: Fix fdtdec_setup_mem..() conversion to livetree API In-Reply-To: <41d165a2-c94e-9f2f-7384-788f65f40776@xilinx.com> References: <20200912104252.80602-1-marek.vasut+renesas@gmail.com> <41d165a2-c94e-9f2f-7384-788f65f40776@xilinx.com> Message-ID: <20200915140148.GH5110@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Tue, Sep 15, 2020 at 03:58:43PM +0200, Michal Simek wrote: > > > On 12. 09. 20 12:42, Marek Vasut wrote: > > 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 > > Cc: Michal Simek > > Cc: Simon Glass > > Cc: Tom Rini > > --- > > lib/fdtdec.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/lib/fdtdec.c b/lib/fdtdec.c > > index d3b22ec323..5f41f58a63 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); > > > > We are not using multiple memory node. We use multiple tuples inside one > memory node that's why it didn't come up. Good catch. > > Reviewed-by: Michal Simek > > Tom: Can you please take it to your tree? Will do, thanks! -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: