Thread (6 messages) 6 messages, 2 authors, 2026-06-15

Re: [PATCH 1/2] powerpc/prom: fix /chosen properties read from wrong node

flat view

From: Rob Herring <robh@kernel.org>
Date: 2026-06-01 22:01:43
Also in: linux-devicetree

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 <redacted>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help