2016-10-12 16:40:45

by Benjamin Tissoires

[permalink] [raw]
Subject: [PATCH] gpio / ACPI: fix returned error from acpi_dev_gpio_irq_get()

From: David Arcari <[email protected]>

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: [email protected]
Signed-off-by: David Arcari <[email protected]>
Signed-off-by: Benjamin Tissoires <[email protected]>
---

Hi David,

I am planning on sending this to the list, any last minute comments?

Cheers,
Benjamin

drivers/gpio/gpiolib-acpi.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
index 9e48e69..f963a12 100644
--- a/drivers/gpio/gpiolib-acpi.c
+++ b/drivers/gpio/gpiolib-acpi.c
@@ -613,14 +613,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);

@@ -639,7 +642,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);

--
2.7.4


2016-10-12 16:55:15

by Benjamin Tissoires

[permalink] [raw]
Subject: Re: [PATCH] gpio / ACPI: fix returned error from acpi_dev_gpio_irq_get()

On Wed, Oct 12, 2016 at 6:40 PM, Benjamin Tissoires
<[email protected]> wrote:
> From: David Arcari <[email protected]>
>
> 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: [email protected]
> Signed-off-by: David Arcari <[email protected]>
> Signed-off-by: Benjamin Tissoires <[email protected]>
> ---
>
> Hi David,
>
> I am planning on sending this to the list, any last minute comments?

Of course, I forgot to remove our internal sync comment.
David's answer was "No. This looks good to me.", so I just went ahead
and send the patch.

Cheers,
Benjamin

2016-10-13 07:11:45

by Mika Westerberg

[permalink] [raw]
Subject: Re: [PATCH] gpio / ACPI: fix returned error from acpi_dev_gpio_irq_get()

On Wed, Oct 12, 2016 at 06:40:30PM +0200, Benjamin Tissoires wrote:
> From: David Arcari <[email protected]>
>
> 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: [email protected]
> Signed-off-by: David Arcari <[email protected]>
> Signed-off-by: Benjamin Tissoires <[email protected]>

Acked-by: Mika Westerberg <[email protected]>

2016-10-20 12:15:47

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH] gpio / ACPI: fix returned error from acpi_dev_gpio_irq_get()

On Wed, Oct 12, 2016 at 6:40 PM, Benjamin Tissoires
<[email protected]> wrote:

> From: David Arcari <[email protected]>
>
> 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: [email protected]
> Signed-off-by: David Arcari <[email protected]>
> Signed-off-by: Benjamin Tissoires <[email protected]>

Patch applied for fixes with Mika's ACK.

Yours,
Linus Walleij