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 Signed-off-by: Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx> --- include/acpi/acpi_bus.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index 53b6e9f9de7b4..c34d94521d40c 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h @@ -445,7 +445,7 @@ static inline bool acpi_data_node_match(const struct fwnode_handle *fwnode, static inline struct fwnode_handle *acpi_fwnode_handle(struct acpi_device *adev) { - return &adev->fwnode; + return adev ? &adev->fwnode : NULL; } static inline void *acpi_driver_data(struct acpi_device *d) -- 2.30.2