[PATCH 08/10] of/fdt: 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 08/10] of/fdt: 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
early_init_dt_check_kho() to improve code maintainability.

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

diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 0f95f3b356ea..fa1703612530 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -890,14 +890,14 @@ static void __init early_init_dt_check_kho(void)
 		return;
 
 	p = of_get_flat_dt_prop(node, "linux,kho-fdt", &l);
-	if (l != (dt_root_addr_cells + dt_root_size_cells) * sizeof(__be32))
+	if (l != dt_root_addr_size_bytes())
 		return;
 
 	fdt_start = dt_mem_next_cell(dt_root_addr_cells, &p);
 	fdt_size = dt_mem_next_cell(dt_root_addr_cells, &p);
 
 	p = of_get_flat_dt_prop(node, "linux,kho-scratch", &l);
-	if (l != (dt_root_addr_cells + dt_root_size_cells) * sizeof(__be32))
+	if (l != dt_root_addr_size_bytes())
 		return;
 
 	scratch_start = dt_mem_next_cell(dt_root_addr_cells, &p);
-- 
2.51.0
Re: [PATCH 08/10] of/fdt: 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:38, Yuntao Wang <yuntao.wang@linux.dev> wrote:
> Use dt_root_addr_size_bytes() instead of open-coding it in
> early_init_dt_check_kho() to improve code maintainability.
>
> Signed-off-by: Yuntao Wang <yuntao.wang@linux.dev>

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

But please combine with the other patch with the same subject.

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