linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Philipp Zabel <p.zabel@pengutronix.de>
To: "Clément Léger" <clement.leger@bootlin.com>
Cc: Rob Herring <robh+dt@kernel.org>,
	Frank Rowand <frowand.list@gmail.com>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Allan Nielsen <allan.nielsen@microchip.com>,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH 2/2] reset: add support for fwnode
Date: Thu, 24 Mar 2022 10:39:47 +0100	[thread overview]
Message-ID: <3cfc4346d314dbb297841a9caf4e68661013016c.camel@pengutronix.de> (raw)
In-Reply-To: <20220324101929.00f51f01@fixe.home>

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@bootlin.com> 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

  reply	other threads:[~2022-03-24  9:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-23  9:50 [PATCH 0/2] add fwnode support to reset subsystem Clément Léger
2022-03-23  9:50 ` [PATCH 1/2] of: add function to convert fwnode_reference_args to of_phandle_args Clément Léger
2022-03-23  9:50 ` [PATCH 2/2] reset: add support for fwnode Clément Léger
2022-03-23 15:29   ` Philipp Zabel
2022-03-23 16:21     ` Clément Léger
2022-03-24  9:19       ` Clément Léger
2022-03-24  9:39         ` Philipp Zabel [this message]
2022-03-24  9:44       ` Philipp Zabel
2022-03-23 15:07 ` [PATCH 0/2] add fwnode support to reset subsystem Philipp Zabel
2022-03-23 16:05   ` Clément Léger
2022-03-24 10:08     ` Philipp Zabel
2022-03-24 10:16       ` Clément Léger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3cfc4346d314dbb297841a9caf4e68661013016c.camel@pengutronix.de \
    --to=p.zabel@pengutronix.de \
    --cc=alexandre.belloni@bootlin.com \
    --cc=allan.nielsen@microchip.com \
    --cc=clement.leger@bootlin.com \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=thomas.petazzoni@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).