[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YiYwL7gCprl69A2c@smile.fi.intel.com>
Date: Mon, 7 Mar 2022 18:17:51 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: "Sa, Nuno" <Nuno.Sa@...log.com>
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
"linux-acpi@...r.kernel.org" <linux-acpi@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Daniel Scally <djrscally@...il.com>,
Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
Sakari Ailus <sakari.ailus@...ux.intel.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Len Brown <lenb@...nel.org>
Subject: Re: [PATCH v2 1/1] device property: Allow error pointer to be passed
to fwnode APIs
On Mon, Mar 07, 2022 at 04:15:23PM +0000, Sa, Nuno wrote:
> > From: Andy Shevchenko <andriy.shevchenko@...ux.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@...log.com>
Thank you!
I'll send v3 because I want to amend the commit message.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists