From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
John Ogness <john.ogness@linutronix.de>,
Mika Westerberg <mika.westerberg@linux.intel.com>
Subject: Re: [PATCH 1/3] ACPI: Make acpi_fwnode_handle safer
Date: Thu, 4 Nov 2021 15:16:33 +0200 [thread overview]
Message-ID: <YYPdMRDOuMFQzku5@paasikivi.fi.intel.com> (raw)
In-Reply-To: <CAJZ5v0i4ZqKPUw1oHT9kt9F6OnZE9AjHZ89tzGm2OHFp-88-YQ@mail.gmail.com>
On Wed, Nov 03, 2021 at 06:55:17PM +0100, Rafael J. Wysocki wrote:
> On Wed, Nov 3, 2021 at 2:33 PM Sakari Ailus
> <sakari.ailus@linux.intel.com> wrote:
> >
> > Check that the fwnode argument passed to acpi_fwnode_handle is non-NULL,
> > and return NULL if it is, otherwise the fwnode. Thus the caller doesn't
> > have to ensure the argument is a valid non-NULL fwnode.
> >
> > Cc: stable@vger.kernel.org # v5.15 and up
>
> Why?
>
> > Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
>
> That's because you want to avoid a NULL check in the second patch and
> it adds a ton of redundant NULL checks all over the place.
>
> Like for example in include/acpi/acpi.h:
>
> #define ACPI_COMPANION_SET(dev, adev) set_primary_fwnode(dev, (adev) ? \
> acpi_fwnode_handle(adev) : NULL)
>
> You should at least get rid of this one.
I went through the users and it seems they don't actually even benefit from
this. So I'll drop the patch.
Most of these little macros are made safer that way but in this case it
seems callers have already acpi_device around, or do checks for other
purposes as well.
--
Sakari Ailus
next prev parent reply other threads:[~2021-11-04 13:16 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-03 13:34 [PATCH 0/3] Get device's parent from parent field, fix sleeping IRQs disabled Sakari Ailus
2021-11-03 13:34 ` [PATCH 1/3] ACPI: Make acpi_fwnode_handle safer Sakari Ailus
2021-11-03 16:58 ` Andy Shevchenko
2021-11-03 17:55 ` Rafael J. Wysocki
2021-11-04 12:48 ` Sakari Ailus
2021-11-04 13:16 ` Sakari Ailus [this message]
2021-11-03 13:34 ` [PATCH 2/3] ACPI: Get acpi_device's parent from the parent field Sakari Ailus
2021-11-03 17:01 ` Andy Shevchenko
2021-11-03 17:48 ` Rafael J. Wysocki
2021-11-04 12:52 ` Sakari Ailus
2021-11-03 13:34 ` [PATCH 3/3] ACPI: Make acpi_node_get_parent() local Sakari Ailus
2021-11-03 17:02 ` Andy Shevchenko
2021-11-04 13:09 ` Sakari Ailus
2021-11-03 14:44 ` [PATCH 0/3] Get device's parent from parent field, fix sleeping IRQs disabled John Ogness
2021-11-03 15:47 ` Petr Mladek
2021-11-03 17:07 ` Andy Shevchenko
2021-11-04 12:45 ` Sakari Ailus
2021-11-03 15:49 ` Petr Mladek
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=YYPdMRDOuMFQzku5@paasikivi.fi.intel.com \
--to=sakari.ailus@linux.intel.com \
--cc=john.ogness@linutronix.de \
--cc=linux-acpi@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=rafael@kernel.org \
/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