On 2026-10-16T07:25:19, Mehmet Fide <[email protected]> wrote:
> fdtdec: match an alias to its stem only when the number follows it
>
> fdtdec_get_alias_seq() and fdtdec_get_alias_highest_id() compare the
> alias name with the stem by strncmp() over the length of the stem, so
> every alias that starts with the stem counts. On a Colibri VF50 the
> aliases usbphy0 and usbphy1 matched the "usb" stem, the two USB
> controllers were given the sequence numbers 2 and 3, and ehci-vf
> indexed its two-entry tables with them. The live tree disagrees: there
> of_alias_scan() splits an alias into the stem and the number and
> of_alias_get_id() compares the stem exactly.
>
> Match an alias only when the stem is followed by its number, as the
> live tree does. A test covers both lookups with the sandbox aliases,
> where "test" is a prefix of testbus3 and of the testfdt aliases.
>
> Signed-off-by: Mehmet Fide <[email protected]>
>
>  lib/fdtdec.c     | 43 ++++++++++++++++++++++++++++++-------------
>  test/dm/fdtdec.c | 35 +++++++++++++++++++++++++++++++++++
>  2 files changed, 65 insertions(+), 13 deletions(-)

Reviewed-by: Simon Glass <[email protected]>

Reply via email to