Skip to contentSkip to conversation

fdtdec: Fix the types of addr and size in fdtdec_add_reserved_memory()

PATCH Superseded Bin Meng 2 participants 5 messages May 20, 2020 – May 21, 2020 Library code

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Bin Meng

author
#0 lore raw

PATCH 1/2 fdtdec: Fix the types of addr and size in fdtdec_add_reserved_memory()

From: Bin Meng <[email protected]>

fdtdec_get_addr_size() expects size is of type 'fdt_size_t', and return value is of type 'fdt_addr_t'. Adjust their types accordingly.

---

 lib/fdtdec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
lib/fdtdec.c +2 -1
index 9c4d571..2d8ef65 100644
@@ -1294,7 +1294,8 @@ int fdtdec_add_reserved_memory(void *blob, const char *basename,
 	/* find a matching node and return the phandle to that */
 	fdt_for_each_subnode(node, blob, parent) {
 		const char *name = fdt_get_name(blob, node, NULL);
-		phys_addr_t addr, size;
+		fdt_addr_t addr;
+		fdt_size_t size;
 
 		addr = fdtdec_get_addr_size(blob, node, "reg", &size);
 		if (addr == FDT_ADDR_T_NONE) {
Signature · 1 line
2.7.4
author
#1 lore raw

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

From: Bin Meng <[email protected]>

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.

---

 lib/fdtdec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
lib/fdtdec.c +2 -1
index 2d8ef65..3bfb462 100644
@@ -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;
Signature · 1 line
2.7.4
#2 lore raw

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

Hi Bin,

Quoted 6 lines · Bin Meng

From: Bin Meng <[email protected]>

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

Quoted 8 lines

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

---

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

Are there no tests for this?

author
#3 lore raw

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

Hi Simon,

Quoted 16 lines · Simon Glass

Hi Bin,

Quoted 12 lines · Bin Meng

From: Bin Meng <[email protected]>

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.

---

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

Are there no tests for this?

There is currently no tests for this unforuatunately.

Regards,
Bin

#4 lore raw

PATCH 1/2 fdtdec: Fix the types of addr and size in fdtdec_add_reserved_memory()

In reply to Bin Meng
Quoted 11 lines · Bin Meng

From: Bin Meng <[email protected]>

fdtdec_get_addr_size() expects size is of type 'fdt_size_t', and return value is of type 'fdt_addr_t'. Adjust their types accordingly.

---

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