Skip to content

Commit

Permalink
gpio / ACPI: fix returned error from acpi_dev_gpio_irq_get()
Browse files Browse the repository at this point in the history
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.

Cc: stable@vger.kernel.org
Signed-off-by: David Arcari <darcari@redhat.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
David Arcari authored and Linus Walleij committed Oct 20, 2016
1 parent 0cb9409 commit 67bf515
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/gpio/gpiolib-acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -653,14 +653,17 @@ int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index)
{
int idx, i;
unsigned int irq_flags;
int ret = -ENOENT;

for (i = 0, idx = 0; idx <= index; i++) {
struct acpi_gpio_info info;
struct gpio_desc *desc;

desc = acpi_get_gpiod_by_index(adev, NULL, i, &info);
if (IS_ERR(desc))
if (IS_ERR(desc)) {
ret = PTR_ERR(desc);
break;
}
if (info.gpioint && idx++ == index) {
int irq = gpiod_to_irq(desc);

Expand All @@ -679,7 +682,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);

Expand Down

0 comments on commit 67bf515

Please sign in to comment.