[1/1] gpio: gpio-altera: Remove gpiochip on probe failure.
diff mbox

Message ID 1452828742-57299-2-git-send-email-preid@electromag.com.au
State New
Headers show

Commit Message

Phil Reid Jan. 15, 2016, 3:32 a.m. UTC
On failure to setup the irq altera_gpio_probe would return an error
but not call altera_gpio_probe. This resulted in kernel fault
"Unable to handle kernel paging request at virtual address xxxxxxxx"
later on in of_gpiochip_find_and_xlate.

Signed-off-by: Phil Reid <preid@electromag.com.au>
---
 drivers/gpio/gpio-altera.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Linus Walleij Jan. 27, 2016, 9:50 a.m. UTC | #1
On Fri, Jan 15, 2016 at 4:32 AM, Phil Reid <preid@electromag.com.au> wrote:

> On failure to setup the irq altera_gpio_probe would return an error
> but not call altera_gpio_probe. This resulted in kernel fault
> "Unable to handle kernel paging request at virtual address xxxxxxxx"
> later on in of_gpiochip_find_and_xlate.
>
> Signed-off-by: Phil Reid <preid@electromag.com.au>

Fixed up commit message and patch applied.

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
Phil Reid Feb. 1, 2016, 3:07 a.m. UTC | #2
On 27/01/2016 5:50 PM, Linus Walleij wrote:
> On Fri, Jan 15, 2016 at 4:32 AM, Phil Reid <preid@electromag.com.au> wrote:
>
>> On failure to setup the irq altera_gpio_probe would return an error
>> but not call altera_gpio_probe. This resulted in kernel fault
>> "Unable to handle kernel paging request at virtual address xxxxxxxx"
>> later on in of_gpiochip_find_and_xlate.
>>
>> Signed-off-by: Phil Reid <preid@electromag.com.au>
>
> Fixed up commit message and patch applied.
>
> 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
>
>
Thanks for fixing that.

Regards
Phil Reid

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

Patch
diff mbox

diff --git a/drivers/gpio/gpio-altera.c b/drivers/gpio/gpio-altera.c
index 3e6661b..7ed30f2 100644
--- a/drivers/gpio/gpio-altera.c
+++ b/drivers/gpio/gpio-altera.c
@@ -317,8 +317,8 @@  static int altera_gpio_probe(struct platform_device *pdev)
 		handle_simple_irq, IRQ_TYPE_NONE);
 
 	if (ret) {
-		dev_info(&pdev->dev, "could not add irqchip\n");
-		return ret;
+		dev_err(&pdev->dev, "could not add irqchip\n");
+		goto teardown;
 	}
 
 	gpiochip_set_chained_irqchip(&altera_gc->mmchip.gc,
@@ -331,6 +331,7 @@  static int altera_gpio_probe(struct platform_device *pdev)
 skip_irq:
 	return 0;
 teardown:
+	of_mm_gpiochip_remove(&altera_gc->mmchip);
 	pr_err("%s: registration failed with status %d\n",
 		node->full_name, ret);