devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Yuntao Wang <yuntao.wang@linux.dev>
Cc: Rob Herring <robh@kernel.org>,
	Saravana Kannan <saravanak@google.com>,
	 Catalin Marinas <catalin.marinas@arm.com>,
	James Morse <james.morse@arm.com>,  Baoquan He <bhe@redhat.com>,
	Zhen Lei <thunder.leizhen@huawei.com>,
	 Andrew Morton <akpm@linux-foundation.org>,
	Changyuan Lyu <changyuanl@google.com>,
	 Alexander Graf <graf@amazon.com>,
	"Mike Rapoport (Microsoft)" <rppt@kernel.org>,
	devicetree@vger.kernel.org,  linux-kernel@vger.kernel.org
Subject: Re: [PATCH 09/10] of/fdt: Fix incorrect use of dt_root_addr_cells in early_init_dt_check_kho()
Date: Wed, 12 Nov 2025 17:54:29 +0100	[thread overview]
Message-ID: <CAMuHMdVpKC94_JPqp0foeeC9Uz8X6st8NLDryGkBqvCc=-CAdQ@mail.gmail.com> (raw)
In-Reply-To: <20251112143520.233870-10-yuntao.wang@linux.dev>

Hi Yuntao,

On Wed, 12 Nov 2025 at 15:38, Yuntao Wang <yuntao.wang@linux.dev> wrote:
> When reading the fdt_size value, the argument passed to dt_mem_next_cell()
> is dt_root_addr_cells, but it should be dt_root_size_cells.
>
> The same issue occurs when reading the scratch_size value.
>
> Fix these issues.
>
> Fixes: 274cdcb1c004 ("arm64: add KHO support")
> Signed-off-by: Yuntao Wang <yuntao.wang@linux.dev>

Thanks for your patch!

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

> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -894,14 +894,14 @@ static void __init early_init_dt_check_kho(void)
>                 return;
>
>         fdt_start = dt_mem_next_cell(dt_root_addr_cells, &p);
> -       fdt_size = dt_mem_next_cell(dt_root_addr_cells, &p);
> +       fdt_size = dt_mem_next_cell(dt_root_size_cells, &p);

I think it would be worthwhile to have separate dt_mem_next_addr_cell()
and dt_mem_next_size_cell() helpers.  That would us bring a few steps
closer to the following goal stated in <linux/of_fdt.h>:

    /* TBD: Temporary export of fdt globals - remove when code fully merged */
    extern int __initdata dt_root_addr_cells;
    extern int __initdata dt_root_size_cells;

>
>         p = of_get_flat_dt_prop(node, "linux,kho-scratch", &l);
>         if (l != dt_root_addr_size_bytes())
>                 return;
>
>         scratch_start = dt_mem_next_cell(dt_root_addr_cells, &p);
> -       scratch_size = dt_mem_next_cell(dt_root_addr_cells, &p);
> +       scratch_size = dt_mem_next_cell(dt_root_size_cells, &p);
>
>         kho_populate(fdt_start, fdt_size, scratch_start, scratch_size);
>  }

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

  reply	other threads:[~2025-11-12 17:01 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-12 14:35 [PATCH 00/10] of/fdt: Some bug fixes and cleanups Yuntao Wang
2025-11-12 14:35 ` [PATCH 01/10] of/fdt: Introduce dt_root_addr_size_cells() and dt_root_addr_size_bytes() Yuntao Wang
2025-11-12 16:25   ` Geert Uytterhoeven
2025-11-12 14:35 ` [PATCH 02/10] of/reserved_mem: Use dt_root_addr_size_bytes() instead of open-coding it Yuntao Wang
2025-11-12 16:28   ` Geert Uytterhoeven
2025-11-12 14:35 ` [PATCH 03/10] " Yuntao Wang
2025-11-12 16:29   ` Geert Uytterhoeven
2025-11-12 14:35 ` [PATCH 04/10] " Yuntao Wang
2025-11-12 16:30   ` Geert Uytterhoeven
2025-11-13 14:21   ` kernel test robot
2025-11-13 23:46   ` kernel test robot
2025-11-12 14:35 ` [PATCH 05/10] of/fdt: " Yuntao Wang
2025-11-12 16:32   ` Geert Uytterhoeven
2025-11-12 14:35 ` [PATCH 06/10] of/fdt: Fix the len check in early_init_dt_check_for_elfcorehdr() Yuntao Wang
2025-11-12 14:35 ` [PATCH 07/10] of/fdt: Fix the len check in early_init_dt_check_for_usable_mem_range() Yuntao Wang
2025-11-12 16:47   ` Geert Uytterhoeven
2025-11-12 14:35 ` [PATCH 08/10] of/fdt: Use dt_root_addr_size_bytes() instead of open-coding it Yuntao Wang
2025-11-12 16:33   ` Geert Uytterhoeven
2025-11-12 14:35 ` [PATCH 09/10] of/fdt: Fix incorrect use of dt_root_addr_cells in early_init_dt_check_kho() Yuntao Wang
2025-11-12 16:54   ` Geert Uytterhoeven [this message]
2025-11-12 14:35 ` [PATCH 10/10] of/address: Remove the incorrect and misleading comment Yuntao Wang
2025-11-12 16:56   ` Geert Uytterhoeven
2025-11-12 20:07   ` Rob Herring
2025-11-12 20:08   ` Rob Herring
2025-11-12 20:55 ` [PATCH 00/10] of/fdt: Some bug fixes and cleanups Rob Herring
2025-11-13 16:00   ` Yuntao Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMuHMdVpKC94_JPqp0foeeC9Uz8X6st8NLDryGkBqvCc=-CAdQ@mail.gmail.com' \
    --to=geert@linux-m68k.org \
    --cc=akpm@linux-foundation.org \
    --cc=bhe@redhat.com \
    --cc=catalin.marinas@arm.com \
    --cc=changyuanl@google.com \
    --cc=devicetree@vger.kernel.org \
    --cc=graf@amazon.com \
    --cc=james.morse@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=rppt@kernel.org \
    --cc=saravanak@google.com \
    --cc=thunder.leizhen@huawei.com \
    --cc=yuntao.wang@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).