Re: [PATCH 2/2] reset: add support for fwnode

From: Philipp Zabel
Date: Thu Mar 24 2022 - 05:40:01 EST


Hi Clément,

On Do, 2022-03-24 at 10:19 +0100, Clément Léger wrote:
> Le Wed, 23 Mar 2022 17:21:21 +0100,
> Clément Léger <clement.leger@xxxxxxxxxxx> a écrit :
>
> > > >         if (id) {
> > > > -               index = of_property_match_string(node,
> > > > -                                                "reset-names",
> > > > id);
> > > > +               index = fwnode_property_match_string(fwnode,
> > > > "reset-names", id);
> > > >                 if (index == -EILSEQ)
> > > >                         return ERR_PTR(index);   
> > >
> > > I don't think this is good enough any more. At least -ENOMEM is added
> > > as a possible error return code by this change. 
> >
> > Yes indeed, errors are clearly not correctly handled anymore. At least
> > -EILSEQ won't be triggered.
> > >
>
> By the way, even after looking at this more carefully, I'm not sure to
> understand why there is a special handling for -EILSEQ ? From what I
> understand, EILSEQ is returned in case the device tree is malformed
> (string longer than returned property length) but why is it handled
> differently in this case ?

of_property_match_string() can return four error codes:

-EINVAL (no reset-names property in node)
-EILSEQ (real error)
-ENODATA (id is not found in reset-names)
-ENOSYS (CONFIG_OF is not set)

-EINVAL, -ENODATA and -ENOSYS map to -ENOENT (no reset control
corresponding to id found), or no error if it is optional.

regards
Philipp