Skip to contentSkip to conversation

riscv: Fix setting no-map in reserved memory nodes

PATCH In review Samuel Holland 4 participants 4 messages Sep 12, 2021 – Sep 17, 2021 1 message not in the archive RISC-V

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 riscv: Fix setting no-map in reserved memory nodes

The no-map property is wrongly skipped if a no-map reserved memory node follows one without that property. Fix this by not remembering the absence of a no-map property across loop iterations.

Fixes d4ea649f179a ("riscv: Provide a mechanism to fix DT for reserved memory")

---

 arch/riscv/lib/fdt_fixup.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
arch/riscv/lib/fdt_fixup.c +1 -4
index f636b284497..61cf8935269 100644
@@ -31,7 +31,6 @@ int riscv_fdt_copy_resv_mem_node(const void *src, void *dst)
 	fdt_addr_t addr;
 	fdt_size_t size;
 	int offset, node, err, rmem_offset;
-	bool nomap = true;
 	char basename[32] = {0};
 	int bname_len;
 	int max_len = sizeof(basename);
@@ -81,9 +80,7 @@ int riscv_fdt_copy_resv_mem_node(const void *src, void *dst)
 			log_err("failed to add reserved memory: %d\n", err);
 			return err;
 		}
-		if (!fdt_getprop(src, node, "no-map", NULL))
-			nomap = false;
-		if (nomap) {
+		if (fdt_getprop(src, node, "no-map", NULL)) {
 			rmem_offset = fdt_node_offset_by_phandle(dst, phandle);
 			fdt_setprop_empty(dst, rmem_offset, "no-map");
 		}
Signature · 1 line
2.31.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Samuel Holland

The no-map property is wrongly skipped if a no-map reserved memory node follows one without that property. Fix this by not remembering the absence of a no-map property across loop iterations.

Quoted 7 lines
Fixes d4ea649f179a ("riscv: Provide a mechanism to fix DT for reserved memory")

---

 arch/riscv/lib/fdt_fixup.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

A message that is not in the archive (sent off-list or not yet received): HK0PR03MB299425ED21B46DDEC6B65EEDC1DD9@HK0PR03MB2994.apcprd03.prod.outlook.com

Reviewed-by
#3 lore raw
Quoted 6 lines

From: Samuel Holland <[email protected]>
Sent: Monday, September 13, 2021 12:06 AM
To: Rick Jian-Zhi Chen(陳建志) <[email protected]>; Leo Yu-Chi Liang(梁育齊) <[email protected]>
Cc: [email protected]; Samuel Holland <[email protected]>; Atish Patra <[email protected]>; Bin Meng <[email protected]>; Etienne Carriere <[email protected]>; Sean Anderson <[email protected]>; Simon Glass <[email protected]>
Subject: [PATCH] riscv: Fix setting no-map in reserved memory nodes

Quoted 8 lines

The no-map property is wrongly skipped if a no-map reserved memory node follows one without that property. Fix this by not remembering the absence of a no-map property across loop iterations.

Fixes d4ea649f179a ("riscv: Provide a mechanism to fix DT for reserved memory")

---

 arch/riscv/lib/fdt_fixup.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
Reviewed-by on v1 1/1
#4 lore raw
In reply to Samuel Holland
Quoted 36 lines · Samuel Holland

The no-map property is wrongly skipped if a no-map reserved memory node follows one without that property. Fix this by not remembering the absence of a no-map property across loop iterations.

Fixes d4ea649f179a ("riscv: Provide a mechanism to fix DT for reserved memory")

---

 arch/riscv/lib/fdt_fixup.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
arch/riscv/lib/fdt_fixup.c +1 -5
index f636b284497..61cf8935269 100644
@@ -31,7 +31,6 @@ int riscv_fdt_copy_resv_mem_node(const void *src, void *dst)
        fdt_addr_t addr;
        fdt_size_t size;
        int offset, node, err, rmem_offset;
-       bool nomap = true;
        char basename[32] = {0};
        int bname_len;
        int max_len = sizeof(basename);
@@ -81,9 +80,7 @@ int riscv_fdt_copy_resv_mem_node(const void *src, void *dst)
                        log_err("failed to add reserved memory: %d\n", err);
                        return err;
                }
-               if (!fdt_getprop(src, node, "no-map", NULL))
-                       nomap = false;
-               if (nomap) {
+               if (fdt_getprop(src, node, "no-map", NULL)) {
                        rmem_offset = fdt_node_offset_by_phandle(dst, phandle);
                        fdt_setprop_empty(dst, rmem_offset, "no-map");
                }
--
Quoted 2 lines

2.31.1

Thanks for catching it.

Signature · 2 lines
Regards,
Atish