Devicetree
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: Sang-Heon Jeon <ekffu200098@gmail.com>
Cc: maddy@linux.ibm.com, mpe@ellerman.id.au, npiggin@gmail.com,
	chleroy@kernel.org, saravanak@kernel.org,
	linuxppc-dev@lists.ozlabs.org, devicetree@vger.kernel.org
Subject: Re: [PATCH 1/2] powerpc/prom: fix /chosen properties read from wrong node
Date: Mon, 1 Jun 2026 17:01:37 -0500	[thread overview]
Message-ID: <20260601220137.GA54006-robh@kernel.org> (raw)
In-Reply-To: <20260510171353.1406018-2-ekffu200098@gmail.com>

On Mon, May 11, 2026 at 02:13:52AM +0900, Sang-Heon Jeon wrote:
> Commit 60f20d84dc81 ("of/fdt: Rework early_init_dt_scan_chosen() to
> call directly") changed early_init_dt_scan_chosen() to be called
> directly instead of via of_scan_flat_dt(). After this change,
> early_init_dt_scan_chosen_ppc() does not behave as intended in either
> case below:
> 
> - /chosen(or /chosen@0) exists: early_init_dt_scan_chosen() always 
>   succeeds, so early_init_dt_scan_chosen_ppc() then reads properties
>   from the root node (first iteration) instead of chosen node.
> 
> - /chosen does not exist:
>   - Until commit 064e32dc5b03 ("of: fdt: Honor CONFIG_CMDLINE* even without
>     /chosen node, take 2"), early_init_dt_scan_chosen() returns -ENOENT
>     and early_init_dt_scan_chosen_ppc() returns 0. So of_scan_flat_dt()
>     iterates over all remaining nodes. Not a bug but unnecessary.
>   - After above commit, early_init_dt_scan_chosen() returns 0 and
>     early_init_dt_scan_chosen_ppc() returns 1. So it reads properties
>     from the root node (first iteration) instead of chosen node, same as
>     the chosen node exist case above.
> 
> Instead of using of_scan_flat_dt() for chosen node handling, first call
> early_init_dt_scan_chosen() directly to handle common chosen node
> properties. Then call early_init_dt_scan_chosen_ppc(), which is updated
> to handle powerpc-specific chosen node properties.
> 
> Both now look up chosen node directly to avoid reading from the wrong node.
> 
> Fixes: 60f20d84dc81 ("of/fdt: Rework early_init_dt_scan_chosen() to call directly")
> Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>

Reviewed-by: Rob Herring (Arm) <robh@kernel.org>

  reply	other threads:[~2026-06-01 22:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-10 17:13 [PATCH 0/2] powerpc/prom, of/fdt: fix chosen node handling and cleanup Sang-Heon Jeon
2026-05-10 17:13 ` [PATCH 1/2] powerpc/prom: fix /chosen properties read from wrong node Sang-Heon Jeon
2026-06-01 22:01   ` Rob Herring [this message]
2026-05-10 17:13 ` [PATCH 2/2] of/fdt: make early_init_dt_scan_chosen() return void Sang-Heon Jeon
2026-06-01 22:03   ` Rob Herring

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=20260601220137.GA54006-robh@kernel.org \
    --to=robh@kernel.org \
    --cc=chleroy@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=ekffu200098@gmail.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=saravanak@kernel.org \
    /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