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@xxxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxx # v5.15 and up > > Why? > > > Signed-off-by: Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx> > > 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