[PATCH 00/13] irqchip: Convert to platform remove callback returning void
this series converts all drivers below drivers/irqchip to use .remove_new(). See commit 5c5a7680e67b ("platform: Provide a remove callback that returns no value") for an extended explanation and the eventual goal. The TL;DR; is to make it harder for driver authors to leak resources.
The drivers touched here are all fine though and don't return early in .remove(). So all conversions in this series are trivial.
Best regards Uwe
Uwe Kleine-König (13): irqchip/imgpdc: Convert to platform remove callback returning void irqchip/imx-intmux: Convert to platform remove callback returning void irqchip/imx-irqsteer: Convert to platform remove callback returning void irqchip/keystone: Convert to platform remove callback returning void irqchip/ls-scfg-msi: Convert to platform remove callback returning void irqchip/madera: Convert to platform remove callback returning void irqchip/mvebu-pic: Convert to platform remove callback returning void irqchip/pruss-intc: Convert to platform remove callback returning void irqchip/renesas-intc-irqpin: Convert to platform remove callback returning void irqchip/renesas-irqc: Convert to platform remove callback returning void irqchip/renesas-rza1: Convert to platform remove callback returning void irqchip/stm32-exti: Convert to platform remove callback returning void irqchip/ts4800: Convert to platform remove callback returning void
drivers/irqchip/irq-imgpdc.c | 5 ++--- drivers/irqchip/irq-imx-intmux.c | 6 ++---- drivers/irqchip/irq-imx-irqsteer.c | 6 ++---- drivers/irqchip/irq-keystone.c | 5 ++--- drivers/irqchip/irq-ls-scfg-msi.c | 6 ++---- drivers/irqchip/irq-madera.c | 6 ++---- drivers/irqchip/irq-mvebu-pic.c | 6 ++---- drivers/irqchip/irq-pruss-intc.c | 6 ++---- drivers/irqchip/irq-renesas-intc-irqpin.c | 5 ++--- drivers/irqchip/irq-renesas-irqc.c | 5 ++--- drivers/irqchip/irq-renesas-rza1.c | 5 ++--- drivers/irqchip/irq-stm32-exti.c | 5 ++--- drivers/irqchip/irq-ts4800.c | 6 ++---- 13 files changed, 26 insertions(+), 46 deletions(-)
base-commit: 39676dfe52331dba909c617f213fdb21015c8d10
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
Signed-off-by: Uwe Kleine-König u.kleine-koenig@pengutronix.de --- drivers/irqchip/irq-madera.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/irqchip/irq-madera.c b/drivers/irqchip/irq-madera.c index 3eb1f8cdf674..b424c0a327f7 100644 --- a/drivers/irqchip/irq-madera.c +++ b/drivers/irqchip/irq-madera.c @@ -222,7 +222,7 @@ static int madera_irq_probe(struct platform_device *pdev) return 0; }
-static int madera_irq_remove(struct platform_device *pdev) +static void madera_irq_remove(struct platform_device *pdev) { struct madera *madera = dev_get_drvdata(pdev->dev.parent);
@@ -232,13 +232,11 @@ static int madera_irq_remove(struct platform_device *pdev) */ madera->irq_dev = NULL; regmap_del_irq_chip(madera->irq, madera->irq_data); - - return 0; }
static struct platform_driver madera_irq_driver = { .probe = &madera_irq_probe, - .remove = &madera_irq_remove, + .remove_new = madera_irq_remove, .driver = { .name = "madera-irq", .pm = &madera_irq_pm_ops,
On 22/12/23 22:50, Uwe Kleine-König wrote:
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
Signed-off-by: Uwe Kleine-König u.kleine-koenig@pengutronix.de
drivers/irqchip/irq-madera.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/irqchip/irq-madera.c b/drivers/irqchip/irq-madera.c index 3eb1f8cdf674..b424c0a327f7 100644 --- a/drivers/irqchip/irq-madera.c +++ b/drivers/irqchip/irq-madera.c @@ -222,7 +222,7 @@ static int madera_irq_probe(struct platform_device *pdev) return 0; }
-static int madera_irq_remove(struct platform_device *pdev) +static void madera_irq_remove(struct platform_device *pdev) { struct madera *madera = dev_get_drvdata(pdev->dev.parent);
@@ -232,13 +232,11 @@ static int madera_irq_remove(struct platform_device *pdev) */ madera->irq_dev = NULL; regmap_del_irq_chip(madera->irq, madera->irq_data);
return 0; }
static struct platform_driver madera_irq_driver = { .probe = &madera_irq_probe,
.remove = &madera_irq_remove,
- .remove_new = madera_irq_remove, .driver = { .name = "madera-irq", .pm = &madera_irq_pm_ops,
Reviewed-by: Richard Fitzgerald rf@opensource.cirrus.com
Hello Thomas,
On Fri, Dec 22, 2023 at 11:50:31PM +0100, Uwe Kleine-König wrote:
this series converts all drivers below drivers/irqchip to use .remove_new(). See commit 5c5a7680e67b ("platform: Provide a remove callback that returns no value") for an extended explanation and the eventual goal. The TL;DR; is to make it harder for driver authors to leak resources.
The drivers touched here are all fine though and don't return early in .remove(). So all conversions in this series are trivial.
I'm still waiting for this series to go in (or get review feedback). Is this still on your radar? You're the right maintainer to take this series, aren't you?
The series still applies to today's next.
Best regards Uwe
On Thu, Feb 15 2024 at 22:03, Uwe Kleine-König wrote:
On Fri, Dec 22, 2023 at 11:50:31PM +0100, Uwe Kleine-König wrote:
this series converts all drivers below drivers/irqchip to use .remove_new(). See commit 5c5a7680e67b ("platform: Provide a remove callback that returns no value") for an extended explanation and the eventual goal. The TL;DR; is to make it harder for driver authors to leak resources.
The drivers touched here are all fine though and don't return early in .remove(). So all conversions in this series are trivial.
I'm still waiting for this series to go in (or get review feedback). Is this still on your radar? You're the right maintainer to take this series, aren't you?
I am and it fell through my christmas crack. I don't even try to catch up with email after being almost 3 weeks AFK. For two decades I rely on submitters to ping me after a couple of weeks or month in this case :)
Thanks,
tglx
participants (3)
-
Richard Fitzgerald
-
Thomas Gleixner
-
Uwe Kleine-König