diff mbox

gpio / ACPI: fix returned error from acpi_dev_gpio_irq_get()

Message ID 1476290430-19542-1-git-send-email-benjamin.tissoires@redhat.com
State New
Headers show

Commit Message

Benjamin Tissoires Oct. 12, 2016, 4:40 p.m. UTC
From: David Arcari <darcari@redhat.com>

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

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

Comments

Benjamin Tissoires Oct. 12, 2016, 4:47 p.m. UTC | #1
On Wed, Oct 12, 2016 at 6:40 PM, Benjamin Tissoires
<benjamin.tissoires@redhat.com> wrote:
> From: David Arcari <darcari@redhat.com>
>
> 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>
> ---
>
> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Mika Westerberg Oct. 13, 2016, 7:10 a.m. UTC | #2
On Wed, Oct 12, 2016 at 06:40:30PM +0200, Benjamin Tissoires wrote:
> From: David Arcari <darcari@redhat.com>
> 
> 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>
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Linus Walleij Oct. 20, 2016, 12:15 p.m. UTC | #3
On Wed, Oct 12, 2016 at 6:40 PM, Benjamin Tissoires
<benjamin.tissoires@redhat.com> wrote:

> From: David Arcari <darcari@redhat.com>
>
> 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>

Patch applied for fixes with Mika's ACK.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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