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
--
2.42.0
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 <[email protected]>
---
drivers/irqchip/irq-renesas-intc-irqpin.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/irqchip/irq-renesas-intc-irqpin.c b/drivers/irqchip/irq-renesas-intc-irqpin.c
index fa19585f3dee..939293bc274e 100644
--- a/drivers/irqchip/irq-renesas-intc-irqpin.c
+++ b/drivers/irqchip/irq-renesas-intc-irqpin.c
@@ -561,14 +561,13 @@ static int intc_irqpin_probe(struct platform_device *pdev)
return ret;
}
-static int intc_irqpin_remove(struct platform_device *pdev)
+static void intc_irqpin_remove(struct platform_device *pdev)
{
struct intc_irqpin_priv *p = platform_get_drvdata(pdev);
irq_domain_remove(p->irq_domain);
pm_runtime_put(&pdev->dev);
pm_runtime_disable(&pdev->dev);
- return 0;
}
static int __maybe_unused intc_irqpin_suspend(struct device *dev)
@@ -585,7 +584,7 @@ static SIMPLE_DEV_PM_OPS(intc_irqpin_pm_ops, intc_irqpin_suspend, NULL);
static struct platform_driver intc_irqpin_device_driver = {
.probe = intc_irqpin_probe,
- .remove = intc_irqpin_remove,
+ .remove_new = intc_irqpin_remove,
.driver = {
.name = "renesas_intc_irqpin",
.of_match_table = intc_irqpin_dt_ids,
--
2.42.0
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 <[email protected]>
---
drivers/irqchip/irq-stm32-exti.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/irqchip/irq-stm32-exti.c b/drivers/irqchip/irq-stm32-exti.c
index 971240e2e31b..c61a97caafc9 100644
--- a/drivers/irqchip/irq-stm32-exti.c
+++ b/drivers/irqchip/irq-stm32-exti.c
@@ -898,10 +898,9 @@ static void stm32_exti_remove_irq(void *data)
irq_domain_remove(domain);
}
-static int stm32_exti_remove(struct platform_device *pdev)
+static void stm32_exti_remove(struct platform_device *pdev)
{
stm32_exti_h_syscore_deinit();
- return 0;
}
static int stm32_exti_probe(struct platform_device *pdev)
@@ -991,7 +990,7 @@ MODULE_DEVICE_TABLE(of, stm32_exti_ids);
static struct platform_driver stm32_exti_driver = {
.probe = stm32_exti_probe,
- .remove = stm32_exti_remove,
+ .remove_new = stm32_exti_remove,
.driver = {
.name = "stm32_exti",
.of_match_table = stm32_exti_ids,
--
2.42.0
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 <[email protected]>
---
drivers/irqchip/irq-mvebu-pic.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/irqchip/irq-mvebu-pic.c b/drivers/irqchip/irq-mvebu-pic.c
index ef3d3646ccc2..57e3f99b61f5 100644
--- a/drivers/irqchip/irq-mvebu-pic.c
+++ b/drivers/irqchip/irq-mvebu-pic.c
@@ -167,14 +167,12 @@ static int mvebu_pic_probe(struct platform_device *pdev)
return 0;
}
-static int mvebu_pic_remove(struct platform_device *pdev)
+static void mvebu_pic_remove(struct platform_device *pdev)
{
struct mvebu_pic *pic = platform_get_drvdata(pdev);
on_each_cpu(mvebu_pic_disable_percpu_irq, pic, 1);
irq_domain_remove(pic->domain);
-
- return 0;
}
static const struct of_device_id mvebu_pic_of_match[] = {
@@ -185,7 +183,7 @@ MODULE_DEVICE_TABLE(of, mvebu_pic_of_match);
static struct platform_driver mvebu_pic_driver = {
.probe = mvebu_pic_probe,
- .remove = mvebu_pic_remove,
+ .remove_new = mvebu_pic_remove,
.driver = {
.name = "mvebu-pic",
.of_match_table = mvebu_pic_of_match,
--
2.42.0
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 <[email protected]>
---
drivers/irqchip/irq-imx-intmux.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/irqchip/irq-imx-intmux.c b/drivers/irqchip/irq-imx-intmux.c
index aa041e4dfee0..de292bde058f 100644
--- a/drivers/irqchip/irq-imx-intmux.c
+++ b/drivers/irqchip/irq-imx-intmux.c
@@ -282,7 +282,7 @@ static int imx_intmux_probe(struct platform_device *pdev)
return ret;
}
-static int imx_intmux_remove(struct platform_device *pdev)
+static void imx_intmux_remove(struct platform_device *pdev)
{
struct intmux_data *data = platform_get_drvdata(pdev);
int i;
@@ -298,8 +298,6 @@ static int imx_intmux_remove(struct platform_device *pdev)
}
pm_runtime_disable(&pdev->dev);
-
- return 0;
}
#ifdef CONFIG_PM
@@ -359,6 +357,6 @@ static struct platform_driver imx_intmux_driver = {
.pm = &imx_intmux_pm_ops,
},
.probe = imx_intmux_probe,
- .remove = imx_intmux_remove,
+ .remove_new = imx_intmux_remove,
};
builtin_platform_driver(imx_intmux_driver);
--
2.42.0
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 <[email protected]>
---
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,
--
2.42.0
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 <[email protected]>
---
drivers/irqchip/irq-imx-irqsteer.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/irqchip/irq-imx-irqsteer.c b/drivers/irqchip/irq-imx-irqsteer.c
index bd9543314539..05f6b5e8370d 100644
--- a/drivers/irqchip/irq-imx-irqsteer.c
+++ b/drivers/irqchip/irq-imx-irqsteer.c
@@ -231,7 +231,7 @@ static int imx_irqsteer_probe(struct platform_device *pdev)
return ret;
}
-static int imx_irqsteer_remove(struct platform_device *pdev)
+static void imx_irqsteer_remove(struct platform_device *pdev)
{
struct irqsteer_data *irqsteer_data = platform_get_drvdata(pdev);
int i;
@@ -243,8 +243,6 @@ static int imx_irqsteer_remove(struct platform_device *pdev)
irq_domain_remove(irqsteer_data->domain);
clk_disable_unprepare(irqsteer_data->ipg_clk);
-
- return 0;
}
#ifdef CONFIG_PM
@@ -312,6 +310,6 @@ static struct platform_driver imx_irqsteer_driver = {
.pm = &imx_irqsteer_pm_ops,
},
.probe = imx_irqsteer_probe,
- .remove = imx_irqsteer_remove,
+ .remove_new = imx_irqsteer_remove,
};
builtin_platform_driver(imx_irqsteer_driver);
--
2.42.0
On Fri, 2023-12-22 at 23:50 +0100, 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 <[email protected]>
Reviewed-by: Antonio Borneo <[email protected]>
Regards,
Antonio
> ---
> drivers/irqchip/irq-stm32-exti.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/irqchip/irq-stm32-exti.c b/drivers/irqchip/irq-stm32-exti.c
> index 971240e2e31b..c61a97caafc9 100644
> --- a/drivers/irqchip/irq-stm32-exti.c
> +++ b/drivers/irqchip/irq-stm32-exti.c
> @@ -898,10 +898,9 @@ static void stm32_exti_remove_irq(void *data)
> irq_domain_remove(domain);
> }
>
> -static int stm32_exti_remove(struct platform_device *pdev)
> +static void stm32_exti_remove(struct platform_device *pdev)
> {
> stm32_exti_h_syscore_deinit();
> - return 0;
> }
>
> static int stm32_exti_probe(struct platform_device *pdev)
> @@ -991,7 +990,7 @@ MODULE_DEVICE_TABLE(of, stm32_exti_ids);
>
> static struct platform_driver stm32_exti_driver = {
> .probe = stm32_exti_probe,
> - .remove = stm32_exti_remove,
> + .remove_new = stm32_exti_remove,
> .driver = {
> .name = "stm32_exti",
> .of_match_table = stm32_exti_ids,
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 <[email protected]>
> ---
> 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 <[email protected]>
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
--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | https://www.pengutronix.de/ |
Uwe Kleine-König <[email protected]> writes:
> 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 <[email protected]>
Acked-by: Gregory CLEMENT <[email protected]>
Thanks,
Gregory
> ---
> drivers/irqchip/irq-mvebu-pic.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/irqchip/irq-mvebu-pic.c b/drivers/irqchip/irq-mvebu-pic.c
> index ef3d3646ccc2..57e3f99b61f5 100644
> --- a/drivers/irqchip/irq-mvebu-pic.c
> +++ b/drivers/irqchip/irq-mvebu-pic.c
> @@ -167,14 +167,12 @@ static int mvebu_pic_probe(struct platform_device *pdev)
> return 0;
> }
>
> -static int mvebu_pic_remove(struct platform_device *pdev)
> +static void mvebu_pic_remove(struct platform_device *pdev)
> {
> struct mvebu_pic *pic = platform_get_drvdata(pdev);
>
> on_each_cpu(mvebu_pic_disable_percpu_irq, pic, 1);
> irq_domain_remove(pic->domain);
> -
> - return 0;
> }
>
> static const struct of_device_id mvebu_pic_of_match[] = {
> @@ -185,7 +183,7 @@ MODULE_DEVICE_TABLE(of, mvebu_pic_of_match);
>
> static struct platform_driver mvebu_pic_driver = {
> .probe = mvebu_pic_probe,
> - .remove = mvebu_pic_remove,
> + .remove_new = mvebu_pic_remove,
> .driver = {
> .name = "mvebu-pic",
> .of_match_table = mvebu_pic_of_match,
> --
> 2.42.0
>
--
Gregory Clement, Bootlin
Embedded Linux and Kernel engineering
http://bootlin.com
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