Re: [PATCH v2] leds: class: Use firmware nodes for device lookup

From: Alban Bedel

Date: Tue Jun 09 2026 - 13:13:20 EST


On Tue, 9 Jun 2026 16:46:36 +0200
Tommaso Merciai <tommaso.merciai.xr@xxxxxxxxxxxxxx> wrote:

> Hi Lee,
> Thanks for your patch.
>
> On Wed, May 20, 2026 at 04:22:25PM +0100, Lee Jones wrote:
> [...]
> > What happens if fwnode_property_match_string() returns an error?
>
> Agree.
>
> I think we need to check index:
> if (index < 0)
> return ERR_PTR(-ENOENT);

I don't think that's the right solution. The documentation of
fwnode_property_get_reference_args() says that it return -ENOENT
when the index is out range. So it looks like the OF implementation
has a bug.

Looking at of_fwnode_get_reference_args() it directly pass the return
value of __of_parse_phandle_with_args(), which return -EINVAL when the
index is out of range. We should rather fix the OF implementation of
fwnode_property_get_reference_args() to respect the documented
interface.

Alban