[PATCH v4 02/10] of: reserved_mem: dedup and relocate reserved-memory messages

From: Wandun Chen

Date: Tue Jun 30 2026 - 03:51:20 EST


From: Wandun Chen <chenwandun@xxxxxxxxxxx>

In both fdt_scan_reserved_mem and fdt_scan_reserved_mem_late, there
are identical check-related print messages. Consolidate these messages
by moving them all into the fdt_scan_reserved_mem function.

No functional change.

Signed-off-by: Wandun Chen <chenwandun@xxxxxxxxxxx>
---
drivers/of/of_reserved_mem.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c
index 82222bd45ac6..42649dc3613f 100644
--- a/drivers/of/of_reserved_mem.c
+++ b/drivers/of/of_reserved_mem.c
@@ -270,19 +270,15 @@ void __init fdt_scan_reserved_mem_late(void)
return;

node = fdt_path_offset(fdt, "/reserved-memory");
- if (node < 0) {
- pr_info("Reserved memory: No reserved-memory node in the DT\n");
+ if (node < 0)
return;
- }

/* Attempt dynamic allocation of a new reserved_mem array */
if (alloc_reserved_mem_array())
return;

- if (__reserved_mem_check_root(node)) {
- pr_err("Reserved memory: unsupported node format, ignoring\n");
+ if (__reserved_mem_check_root(node))
return;
- }

fdt_for_each_subnode(child, fdt, node) {
const __be32 *prop;
@@ -337,6 +333,7 @@ int __init fdt_scan_reserved_mem(void)

node = fdt_path_offset(fdt, "/reserved-memory");
if (node < 0) {
+ pr_info("Reserved memory: No reserved-memory node in the DT\n");
total_reserved_mem_cnt = 0;
return -ENODEV;
}
--
2.43.0