Skip to content

Commit 73c13c8

Browse files
reid-plinusw
authored andcommitted
gpio: gpio-altera: Remove gpiochip on probe failure.
On failure to setup the irq altera_gpio_probe would return an error but not go to cleanup. 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 <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
1 parent 92e963f commit 73c13c8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/gpio/gpio-altera.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,8 @@ static int altera_gpio_probe(struct platform_device *pdev)
312312
handle_simple_irq, IRQ_TYPE_NONE);
313313

314314
if (ret) {
315-
dev_info(&pdev->dev, "could not add irqchip\n");
316-
return ret;
315+
dev_err(&pdev->dev, "could not add irqchip\n");
316+
goto teardown;
317317
}
318318

319319
gpiochip_set_chained_irqchip(&altera_gc->mmchip.gc,
@@ -326,6 +326,7 @@ static int altera_gpio_probe(struct platform_device *pdev)
326326
skip_irq:
327327
return 0;
328328
teardown:
329+
of_mm_gpiochip_remove(&altera_gc->mmchip);
329330
pr_err("%s: registration failed with status %d\n",
330331
node->full_name, ret);
331332

0 commit comments

Comments
 (0)