public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: "Sa, Nuno" <Nuno.Sa@analog.com>
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Daniel Scally <djrscally@gmail.com>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Len Brown <lenb@kernel.org>
Subject: Re: [PATCH v2 1/1] device property: Allow error pointer to be passed to fwnode APIs
Date: Mon, 7 Mar 2022 18:17:51 +0200	[thread overview]
Message-ID: <YiYwL7gCprl69A2c@smile.fi.intel.com> (raw)
In-Reply-To: <PH0PR03MB67863963179FBA901E649C7599089@PH0PR03MB6786.namprd03.prod.outlook.com>

On Mon, Mar 07, 2022 at 04:15:23PM +0000, Sa, Nuno wrote:
> > From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > Sent: Friday, March 4, 2022 6:33 PM

...

> > Some of the fwnode APIs might return an error pointer instead of
> > NULL
> > or valid fwnode handle. The result of such API call may be considered
> > optional and hence the test for it is usually done in a form of
> > 
> > 	fwnode = fwnode_find_reference(...);
> > 	if (IS_ERR_OR_NULL(fwnode))
> > 		...error handling...
> > 
> > Nevertheless the resulting fwnode may have bumped reference count
> > and
> > hence caller of the above API is obliged to call fwnode_handle_put().
> > Since fwnode may be not valid either as NULL or error pointer the
> > check
> > has to be performed there. This approach uglifies the code and adds
> > a point of making a mistake, i.e. forgetting about error point case.
> > 
> > To prevent this allow error pointer to be passed to the fwnode APIs.

...

> > v2: adjusted the entire fwnode API (Sakari)
> > 
> > Nuno, can you test this with the ltc2983 series, including the
> > IS_ERR_OR_NULL()
> > fix to it?
> 
> Hi Andy,
> 
> Just tested this patch with the ltc2983 series and now 
> fwnode_handle_put() does not crash when fwnode is an
> error pointer. I think this usecase does not cover all
> of the patch so I'm not sure if a tested by tag here is
> meaningful...

I believe it still makes sense because we understand what you have tested.
And at least it has some kind of BAT:
- compile testing
- testing (some of the) branches

> If it is, go ahead:
> 
> Tested-by: Nuno Sá <nuno.sa@analog.com>

Thank you!

I'll send v3 because I want to amend the commit message.

-- 
With Best Regards,
Andy Shevchenko



      reply	other threads:[~2022-03-07 16:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-04 17:32 [PATCH v2 1/1] device property: Allow error pointer to be passed to fwnode APIs Andy Shevchenko
2022-03-05 12:46 ` Nuno Sá
2022-03-05 21:46   ` Andy Shevchenko
2022-03-07 16:15 ` Sa, Nuno
2022-03-07 16:17   ` Andy Shevchenko [this message]

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=YiYwL7gCprl69A2c@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=Nuno.Sa@analog.com \
    --cc=djrscally@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=rafael@kernel.org \
    --cc=sakari.ailus@linux.intel.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