diff mbox series

gpiolib: acpi: Add ACPI device NULL check to acpi_can_fallback_to_crs()

Message ID 20240509104605.538274-1-laura.nao@collabora.com
State New
Headers show
Series gpiolib: acpi: Add ACPI device NULL check to acpi_can_fallback_to_crs() | expand

Commit Message

Laura Nao May 9, 2024, 10:46 a.m. UTC
Check ACPI device for NULL inside acpi_can_fallback_to_crs(), so callers
won't need to.

Signed-off-by: Laura Nao <laura.nao@collabora.com>
Reported-by: "kernelci.org bot" <bot@kernelci.org>
Closes: https://lore.kernel.org/all/20240426154208.81894-1-laura.nao@collabora.com/
Fixes: 49c02f6e901c ("gpiolib: acpi: Move acpi_can_fallback_to_crs() out of __acpi_find_gpio()")

---
 drivers/gpio/gpiolib-acpi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
index 553a5f94c00a..688aff6e51bc 100644
--- a/drivers/gpio/gpiolib-acpi.c
+++ b/drivers/gpio/gpiolib-acpi.c
@@ -939,7 +939,7 @@  static bool acpi_can_fallback_to_crs(struct acpi_device *adev,
 				     const char *con_id)
 {
 	/* Never allow fallback if the device has properties */
-	if (acpi_dev_has_props(adev) || adev->driver_gpios)
+	if (!adev || acpi_dev_has_props(adev) || adev->driver_gpios)
 		return false;
 
 	return con_id == NULL;