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

From: Laura Nao
Date: Thu May 09 2024 - 06:45:46 EST


Check ACPI device for NULL inside acpi_can_fallback_to_crs(), so callers
won't need to.

Signed-off-by: Laura Nao <laura.nao@xxxxxxxxxxxxx>
Reported-by: "kernelci.org bot" <bot@xxxxxxxxxxxx>
Closes: https://lore.kernel.org/all/20240426154208.81894-1-laura.nao@xxxxxxxxxxxxx/
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 --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;
--
2.30.2