gpio: mvebu: fix irq domain leak
[ Upstream commit 644ee70267a934be27370f9aa618b29af7290544 ]
Uwe Kleine-König pointed out we still have one resource leak in the mvebu
driver triggered on driver detach. Let's address it with a custom devm
action.
Fixes: 812d47889a
("gpio/mvebu: Use irq_domain_add_linear")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
8ee94aab99
commit
44e2afbf65
@ -1112,6 +1112,13 @@ static int mvebu_gpio_probe_syscon(struct platform_device *pdev,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void mvebu_gpio_remove_irq_domain(void *data)
|
||||||
|
{
|
||||||
|
struct irq_domain *domain = data;
|
||||||
|
|
||||||
|
irq_domain_remove(domain);
|
||||||
|
}
|
||||||
|
|
||||||
static int mvebu_gpio_probe(struct platform_device *pdev)
|
static int mvebu_gpio_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct mvebu_gpio_chip *mvchip;
|
struct mvebu_gpio_chip *mvchip;
|
||||||
@ -1246,13 +1253,18 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
|
|||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err = devm_add_action_or_reset(&pdev->dev, mvebu_gpio_remove_irq_domain,
|
||||||
|
mvchip->domain);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
|
||||||
err = irq_alloc_domain_generic_chips(
|
err = irq_alloc_domain_generic_chips(
|
||||||
mvchip->domain, ngpios, 2, np->name, handle_level_irq,
|
mvchip->domain, ngpios, 2, np->name, handle_level_irq,
|
||||||
IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_LEVEL, 0, 0);
|
IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_LEVEL, 0, 0);
|
||||||
if (err) {
|
if (err) {
|
||||||
dev_err(&pdev->dev, "couldn't allocate irq chips %s (DT).\n",
|
dev_err(&pdev->dev, "couldn't allocate irq chips %s (DT).\n",
|
||||||
mvchip->chip.label);
|
mvchip->chip.label);
|
||||||
goto err_domain;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1292,10 +1304,6 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err_domain:
|
|
||||||
irq_domain_remove(mvchip->domain);
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct platform_driver mvebu_gpio_driver = {
|
static struct platform_driver mvebu_gpio_driver = {
|
||||||
|
Loading…
Reference in New Issue
Block a user