Commit 56ffab4f authored by David Arcari's avatar David Arcari Committed by Greg Kroah-Hartman

gpio / ACPI: fix returned error from acpi_dev_gpio_irq_get()

commit 67bf5156 upstream.

acpi_dev_gpio_irq_get() currently ignores the error returned
by acpi_get_gpiod_by_index() and overwrites it with -ENOENT.

Problem is this error can be -EPROBE_DEFER, which just blows
up some drivers when the module ordering is not correct.
Signed-off-by: default avatarDavid Arcari <darcari@redhat.com>
Signed-off-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 43662461
...@@ -602,14 +602,17 @@ int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index) ...@@ -602,14 +602,17 @@ int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index)
{ {
int idx, i; int idx, i;
unsigned int irq_flags; unsigned int irq_flags;
int ret = -ENOENT;
for (i = 0, idx = 0; idx <= index; i++) { for (i = 0, idx = 0; idx <= index; i++) {
struct acpi_gpio_info info; struct acpi_gpio_info info;
struct gpio_desc *desc; struct gpio_desc *desc;
desc = acpi_get_gpiod_by_index(adev, NULL, i, &info); desc = acpi_get_gpiod_by_index(adev, NULL, i, &info);
if (IS_ERR(desc)) if (IS_ERR(desc)) {
ret = PTR_ERR(desc);
break; break;
}
if (info.gpioint && idx++ == index) { if (info.gpioint && idx++ == index) {
int irq = gpiod_to_irq(desc); int irq = gpiod_to_irq(desc);
...@@ -628,7 +631,7 @@ int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index) ...@@ -628,7 +631,7 @@ int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index)
} }
} }
return -ENOENT; return ret;
} }
EXPORT_SYMBOL_GPL(acpi_dev_gpio_irq_get); EXPORT_SYMBOL_GPL(acpi_dev_gpio_irq_get);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment