linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpiolib: acpi: Add ACPI device NULL check to acpi_can_fallback_to_crs()
@ 2024-05-09 10:46 Laura Nao
  2024-05-09 12:55 ` AngeloGioacchino Del Regno
  2024-05-10 14:46 ` Andy Shevchenko
  0 siblings, 2 replies; 4+ messages in thread
From: Laura Nao @ 2024-05-09 10:46 UTC (permalink / raw)
  To: mika.westerberg, andriy.shevchenko
  Cc: linus.walleij, brgl, kernel, linux-kernel, linux-gpio, linux-acpi,
	Laura Nao, kernelci.org bot

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 --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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-05-13 10:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-09 10:46 [PATCH] gpiolib: acpi: Add ACPI device NULL check to acpi_can_fallback_to_crs() Laura Nao
2024-05-09 12:55 ` AngeloGioacchino Del Regno
2024-05-10 14:46 ` Andy Shevchenko
2024-05-13 10:02   ` [PATCH] gpiolib: acpi: Add ACPI device NULL check to Laura Nao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).