Skip to content

Commit 644ee70

Browse files
author
Bartosz Golaszewski
committed
gpio: mvebu: fix irq domain leak
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: 812d478 ("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>
1 parent 1945063 commit 644ee70

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

drivers/gpio/gpio-mvebu.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,6 +1112,13 @@ static int mvebu_gpio_probe_syscon(struct platform_device *pdev,
11121112
return 0;
11131113
}
11141114

1115+
static void mvebu_gpio_remove_irq_domain(void *data)
1116+
{
1117+
struct irq_domain *domain = data;
1118+
1119+
irq_domain_remove(domain);
1120+
}
1121+
11151122
static int mvebu_gpio_probe(struct platform_device *pdev)
11161123
{
11171124
struct mvebu_gpio_chip *mvchip;
@@ -1246,13 +1253,18 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
12461253
return -ENODEV;
12471254
}
12481255

1256+
err = devm_add_action_or_reset(&pdev->dev, mvebu_gpio_remove_irq_domain,
1257+
mvchip->domain);
1258+
if (err)
1259+
return err;
1260+
12491261
err = irq_alloc_domain_generic_chips(
12501262
mvchip->domain, ngpios, 2, np->name, handle_level_irq,
12511263
IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_LEVEL, 0, 0);
12521264
if (err) {
12531265
dev_err(&pdev->dev, "couldn't allocate irq chips %s (DT).\n",
12541266
mvchip->chip.label);
1255-
goto err_domain;
1267+
return err;
12561268
}
12571269

12581270
/*
@@ -1292,10 +1304,6 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
12921304
}
12931305

12941306
return 0;
1295-
1296-
err_domain:
1297-
irq_domain_remove(mvchip->domain);
1298-
return err;
12991307
}
13001308

13011309
static struct platform_driver mvebu_gpio_driver = {

0 commit comments

Comments
 (0)