Skip to content

Commit a1cdaa6

Browse files
andy-shevlinusw
authored andcommitted
gpio: crystalcove: Free IRQ on error path
It appears that all, but request_irq(), calls in the driver are device managed. In unlikely case of devm_gpiochip_add_data() failure the IRQ left requested. Free IRQ on error path by switching to devm_request_threaded_irq() API. Byproduct of this change is a drop of ->remove() callback completely. Fixes: 945e72d ("gpio: crystalcove: Use irqchip template") Signed-off-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
1 parent 2a93a0d commit a1cdaa6

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

drivers/gpio/gpio-crystalcove.c

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -364,9 +364,9 @@ static int crystalcove_gpio_probe(struct platform_device *pdev)
364364
girq->handler = handle_simple_irq;
365365
girq->threaded = true;
366366

367-
retval = request_threaded_irq(irq, NULL, crystalcove_gpio_irq_handler,
368-
IRQF_ONESHOT, KBUILD_MODNAME, cg);
369-
367+
retval = devm_request_threaded_irq(&pdev->dev, irq, NULL,
368+
crystalcove_gpio_irq_handler,
369+
IRQF_ONESHOT, KBUILD_MODNAME, cg);
370370
if (retval) {
371371
dev_warn(&pdev->dev, "request irq failed: %d\n", retval);
372372
return retval;
@@ -381,24 +381,12 @@ static int crystalcove_gpio_probe(struct platform_device *pdev)
381381
return 0;
382382
}
383383

384-
static int crystalcove_gpio_remove(struct platform_device *pdev)
385-
{
386-
struct crystalcove_gpio *cg = platform_get_drvdata(pdev);
387-
int irq = platform_get_irq(pdev, 0);
388-
389-
if (irq >= 0)
390-
free_irq(irq, cg);
391-
return 0;
392-
}
393-
394384
static struct platform_driver crystalcove_gpio_driver = {
395385
.probe = crystalcove_gpio_probe,
396-
.remove = crystalcove_gpio_remove,
397386
.driver = {
398387
.name = "crystal_cove_gpio",
399388
},
400389
};
401-
402390
module_platform_driver(crystalcove_gpio_driver);
403391

404392
MODULE_AUTHOR("Yang, Bin <[email protected]>");

0 commit comments

Comments
 (0)