Re: [PATCH v7 4/4] device property: Fix fwnode_name_eq() for empty node names

From: Andy Shevchenko

Date: Wed Nov 25 2026 - 17:00:17 EST


On Wed, Nov 25, 2026 at 10:03:55PM +0100, Alejandro Colomar wrote:
> str_has_prefix() returns the prefix length on match and 0 on mismatch,
> so the mistmatch case can't be told from "empty prefix matched an empty
> string".
>
> For instance: the OF root node's name as returned by
> fwnode_get_name() is "" and will return 0 for any name matched against
> it and since len is 0 too, fwnode_name_eq() will return true.
>
> Let's use strprefix() instead, which also makes this function simpler.

...

> Message-ID: <avrSUUM3HMgxTNpl@kekkonen.localdomain>
> Message-ID: <nat4ilqmzzpuyrjbuahl367ip22tfnmjorydlppuwqiscxaujo@kf63j4lb3flk>
> Message-ID: <nat4ilqmzzpuyrjbuahl367ip22tfnmjorydlppuwqiscxaujo@kf63j4lb3flk>

What is this? Is it documented tag nowadays?

--
With Best Regards,
Andy Shevchenko