[PATCH 02/10] of/reserved_mem: Use dt_root_addr_size_bytes() instead of open-coding it

Yuntao Wang posted 10 patches 2 months, 4 weeks ago
There is a newer version of this series
[PATCH 02/10] of/reserved_mem: Use dt_root_addr_size_bytes() instead of open-coding it
Posted by Yuntao Wang 2 months, 4 weeks ago
Use dt_root_addr_size_bytes() instead of open-coding it in
__reserved_mem_reserve_reg() to improve code maintainability.

Signed-off-by: Yuntao Wang <yuntao.wang@linux.dev>
---
 drivers/of/of_reserved_mem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c
index 2e9ea751ed2d..67c0ccd373c2 100644
--- a/drivers/of/of_reserved_mem.c
+++ b/drivers/of/of_reserved_mem.c
@@ -154,7 +154,7 @@ static int __init early_init_dt_reserve_memory(phys_addr_t base,
 static int __init __reserved_mem_reserve_reg(unsigned long node,
 					     const char *uname)
 {
-	int t_len = (dt_root_addr_cells + dt_root_size_cells) * sizeof(__be32);
+	int t_len = dt_root_addr_size_bytes();
 	phys_addr_t base, size;
 	int len;
 	const __be32 *prop;
-- 
2.51.0
Re: [PATCH 02/10] of/reserved_mem: Use dt_root_addr_size_bytes() instead of open-coding it
Posted by Geert Uytterhoeven 2 months, 4 weeks ago
On Wed, 12 Nov 2025 at 15:37, Yuntao Wang <yuntao.wang@linux.dev> wrote:
> Use dt_root_addr_size_bytes() instead of open-coding it in
> __reserved_mem_reserve_reg() to improve code maintainability.
>
> Signed-off-by: Yuntao Wang <yuntao.wang@linux.dev>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds