diff mbox series

[2/2] fdtdec: Honor #address-cells and #size-cells in fdtdec_add_reserved_memory()

Message ID 1589956713-5175-2-git-send-email-bmeng.cn@gmail.com
State New
Headers show
Series [1/2] fdtdec: Fix the types of addr and size in fdtdec_add_reserved_memory() | expand

Commit Message

Bin Meng May 20, 2020, 6:38 a.m. UTC
From: Bin Meng <bin.meng at windriver.com>

At present fdtdec_add_reserved_memory() calls fdtdec_get_addr_size()
to get address and size for the subnodes of /reserved-memory node.

We should honor #address-cells and #size-cells properties in the
parent node.

Signed-off-by: Bin Meng <bin.meng at windriver.com>
---

 lib/fdtdec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Simon Glass May 20, 2020, 2:20 p.m. UTC | #1
Hi Bin,

On Wed, 20 May 2020 at 00:38, Bin Meng <bmeng.cn at gmail.com> wrote:
>
> From: Bin Meng <bin.meng at windriver.com>
>
> At present fdtdec_add_reserved_memory() calls fdtdec_get_addr_size()
> to get address and size for the subnodes of /reserved-memory node.
>
> We should honor #address-cells and #size-cells properties in the
> parent node.
>
> Signed-off-by: Bin Meng <bin.meng at windriver.com>
> ---
>
>  lib/fdtdec.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg at chromium.org>

Are there no tests for this?
Bin Meng May 21, 2020, 2:18 a.m. UTC | #2
Hi Simon,

On Wed, May 20, 2020 at 10:20 PM Simon Glass <sjg at chromium.org> wrote:
>
> Hi Bin,
>
> On Wed, 20 May 2020 at 00:38, Bin Meng <bmeng.cn at gmail.com> wrote:
> >
> > From: Bin Meng <bin.meng at windriver.com>
> >
> > At present fdtdec_add_reserved_memory() calls fdtdec_get_addr_size()
> > to get address and size for the subnodes of /reserved-memory node.
> >
> > We should honor #address-cells and #size-cells properties in the
> > parent node.
> >
> > Signed-off-by: Bin Meng <bin.meng at windriver.com>
> > ---
> >
> >  lib/fdtdec.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
>
> Reviewed-by: Simon Glass <sjg at chromium.org>
>
> Are there no tests for this?

There is currently no tests for this unforuatunately.

Regards,
Bin
diff mbox series

Patch

diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 2d8ef65..3bfb462 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -1297,7 +1297,8 @@  int fdtdec_add_reserved_memory(void *blob, const char *basename,
 		fdt_addr_t addr;
 		fdt_size_t size;
 
-		addr = fdtdec_get_addr_size(blob, node, "reg", &size);
+		addr = fdtdec_get_addr_size_fixed(blob, node, "reg", 0, na, ns,
+						  &size, false);
 		if (addr == FDT_ADDR_T_NONE) {
 			debug("failed to read address/size for %s\n", name);
 			continue;