Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933250AbcKILF4 (ORCPT ); Wed, 9 Nov 2016 06:05:56 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:54078 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932345AbcKILFw (ORCPT ); Wed, 9 Nov 2016 06:05:52 -0500 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Arcari , Benjamin Tissoires , Mika Westerberg , Linus Walleij Subject: [PATCH 4.8 008/138] gpio / ACPI: fix returned error from acpi_dev_gpio_irq_get() Date: Wed, 9 Nov 2016 11:44:51 +0100 Message-Id: <20161109102845.175731107@linuxfoundation.org> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161109102844.808685475@linuxfoundation.org> References: <20161109102844.808685475@linuxfoundation.org> User-Agent: quilt/0.64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1505 Lines: 55 4.8-stable review patch. If anyone has any objections, please let me know. ------------------ From: David Arcari commit 67bf5156edc4f58241fd7c119ae145c552adddd6 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: David Arcari Signed-off-by: Benjamin Tissoires Acked-by: Mika Westerberg Signed-off-by: Linus Walleij Signed-off-by: Greg Kroah-Hartman --- drivers/gpio/gpiolib-acpi.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c @@ -602,14 +602,17 @@ int acpi_dev_gpio_irq_get(struct acpi_de { 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); @@ -628,7 +631,7 @@ int acpi_dev_gpio_irq_get(struct acpi_de } } - return -ENOENT; + return ret; } EXPORT_SYMBOL_GPL(acpi_dev_gpio_irq_get);