diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2020-07-28 15:55:03 +0300 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2020-08-04 01:25:02 +0200 |
commit | a1cdaa64aab217a282fc3577f7c560ffaa75dcd0 (patch) | |
tree | 72a7e397a669c89400b6173b7e94a1ddea698915 /drivers/gpio | |
parent | 2a93a0da06f8fcee96a7c49c756fd7c5891b0b0d (diff) | |
download | linux-stable-a1cdaa64aab217a282fc3577f7c560ffaa75dcd0.tar.gz linux-stable-a1cdaa64aab217a282fc3577f7c560ffaa75dcd0.tar.bz2 linux-stable-a1cdaa64aab217a282fc3577f7c560ffaa75dcd0.zip |
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: 945e72db36bd ("gpio: crystalcove: Use irqchip template")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20200728125504.27786-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpio-crystalcove.c | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/drivers/gpio/gpio-crystalcove.c b/drivers/gpio/gpio-crystalcove.c index f60ff7579cd0..2ba225720086 100644 --- a/drivers/gpio/gpio-crystalcove.c +++ b/drivers/gpio/gpio-crystalcove.c @@ -364,9 +364,9 @@ static int crystalcove_gpio_probe(struct platform_device *pdev) girq->handler = handle_simple_irq; girq->threaded = true; - retval = request_threaded_irq(irq, NULL, crystalcove_gpio_irq_handler, - IRQF_ONESHOT, KBUILD_MODNAME, cg); - + retval = devm_request_threaded_irq(&pdev->dev, irq, NULL, + crystalcove_gpio_irq_handler, + IRQF_ONESHOT, KBUILD_MODNAME, cg); if (retval) { dev_warn(&pdev->dev, "request irq failed: %d\n", retval); return retval; @@ -381,24 +381,12 @@ static int crystalcove_gpio_probe(struct platform_device *pdev) return 0; } -static int crystalcove_gpio_remove(struct platform_device *pdev) -{ - struct crystalcove_gpio *cg = platform_get_drvdata(pdev); - int irq = platform_get_irq(pdev, 0); - - if (irq >= 0) - free_irq(irq, cg); - return 0; -} - static struct platform_driver crystalcove_gpio_driver = { .probe = crystalcove_gpio_probe, - .remove = crystalcove_gpio_remove, .driver = { .name = "crystal_cove_gpio", }, }; - module_platform_driver(crystalcove_gpio_driver); MODULE_AUTHOR("Yang, Bin <bin.yang@intel.com>"); |