Skip to content

Commit 4bcc9bb

Browse files
laura-naoandy-shev
authored andcommitted
gpiolib: acpi: Move ACPI device NULL check to acpi_can_fallback_to_crs()
Following the relocation of the function call outside of __acpi_find_gpio(), move the ACPI device NULL check to acpi_can_fallback_to_crs(). Signed-off-by: Laura Nao <laura.nao@collabora.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reported-by: kernelci.org bot <bot@kernelci.org> Closes: https://lore.kernel.org/all/20240426154208.81894-1-laura.nao@collabora.com/ Fixes: 49c02f6 ("gpiolib: acpi: Move acpi_can_fallback_to_crs() out of __acpi_find_gpio()") Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
1 parent 8f6a15f commit 4bcc9bb

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

drivers/gpio/gpiolib-acpi.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -938,6 +938,10 @@ static struct gpio_desc *acpi_get_gpiod_from_data(struct fwnode_handle *fwnode,
938938
static bool acpi_can_fallback_to_crs(struct acpi_device *adev,
939939
const char *con_id)
940940
{
941+
/* If there is no ACPI device, there is no _CRS to fall back to */
942+
if (!adev)
943+
return false;
944+
941945
/* Never allow fallback if the device has properties */
942946
if (acpi_dev_has_props(adev) || adev->driver_gpios)
943947
return false;
@@ -978,10 +982,10 @@ __acpi_find_gpio(struct fwnode_handle *fwnode, const char *con_id, unsigned int
978982
}
979983

980984
/* Then from plain _CRS GPIOs */
981-
if (!adev || !can_fallback)
982-
return ERR_PTR(-ENOENT);
985+
if (can_fallback)
986+
return acpi_get_gpiod_by_index(adev, NULL, idx, info);
983987

984-
return acpi_get_gpiod_by_index(adev, NULL, idx, info);
988+
return ERR_PTR(-ENOENT);
985989
}
986990

987991
struct gpio_desc *acpi_find_gpio(struct fwnode_handle *fwnode,

0 commit comments

Comments
 (0)