* [PATCH 02/13] irqchip/imx-intmux: Convert to platform remove callback returning void
2023-12-22 22:50 [PATCH 00/13] irqchip: Convert to platform remove callback returning void Uwe Kleine-König
@ 2023-12-22 22:50 ` Uwe Kleine-König
2023-12-22 22:50 ` [PATCH 03/13] irqchip/imx-irqsteer: " Uwe Kleine-König
` (3 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: Uwe Kleine-König @ 2023-12-22 22:50 UTC (permalink / raw)
To: Thomas Gleixner
Cc: Shawn Guo, Sascha Hauer, Fabio Estevam, NXP Linux Team,
linux-kernel, linux-arm-kernel, kernel
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-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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 03/13] irqchip/imx-irqsteer: Convert to platform remove callback returning void
2023-12-22 22:50 [PATCH 00/13] irqchip: Convert to platform remove callback returning void Uwe Kleine-König
2023-12-22 22:50 ` [PATCH 02/13] irqchip/imx-intmux: " Uwe Kleine-König
@ 2023-12-22 22:50 ` Uwe Kleine-König
2023-12-22 22:50 ` [PATCH 07/13] irqchip/mvebu-pic: " Uwe Kleine-König
` (2 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: Uwe Kleine-König @ 2023-12-22 22:50 UTC (permalink / raw)
To: Thomas Gleixner
Cc: Shawn Guo, Sascha Hauer, Fabio Estevam, NXP Linux Team,
linux-kernel, linux-arm-kernel, kernel
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-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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 07/13] irqchip/mvebu-pic: Convert to platform remove callback returning void
2023-12-22 22:50 [PATCH 00/13] irqchip: Convert to platform remove callback returning void Uwe Kleine-König
2023-12-22 22:50 ` [PATCH 02/13] irqchip/imx-intmux: " Uwe Kleine-König
2023-12-22 22:50 ` [PATCH 03/13] irqchip/imx-irqsteer: " Uwe Kleine-König
@ 2023-12-22 22:50 ` Uwe Kleine-König
2024-02-27 16:44 ` Gregory CLEMENT
2023-12-22 22:50 ` [PATCH 12/13] irqchip/stm32-exti: " Uwe Kleine-König
2024-02-15 21:03 ` [PATCH 00/13] irqchip: " Uwe Kleine-König
4 siblings, 1 reply; 9+ messages in thread
From: Uwe Kleine-König @ 2023-12-22 22:50 UTC (permalink / raw)
To: Thomas Gleixner
Cc: Andrew Lunn, Gregory Clement, Sebastian Hesselbarth,
linux-arm-kernel, linux-kernel, kernel
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-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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH 07/13] irqchip/mvebu-pic: Convert to platform remove callback returning void
2023-12-22 22:50 ` [PATCH 07/13] irqchip/mvebu-pic: " Uwe Kleine-König
@ 2024-02-27 16:44 ` Gregory CLEMENT
0 siblings, 0 replies; 9+ messages in thread
From: Gregory CLEMENT @ 2024-02-27 16:44 UTC (permalink / raw)
To: Uwe Kleine-König, Thomas Gleixner
Cc: Andrew Lunn, Sebastian Hesselbarth, linux-arm-kernel,
linux-kernel, kernel
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> 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 <u.kleine-koenig@pengutronix.de>
Acked-by: Gregory CLEMENT <gregory.clement@bootlin.com>
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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 12/13] irqchip/stm32-exti: Convert to platform remove callback returning void
2023-12-22 22:50 [PATCH 00/13] irqchip: Convert to platform remove callback returning void Uwe Kleine-König
` (2 preceding siblings ...)
2023-12-22 22:50 ` [PATCH 07/13] irqchip/mvebu-pic: " Uwe Kleine-König
@ 2023-12-22 22:50 ` Uwe Kleine-König
2023-12-24 11:59 ` [Linux-stm32] " Antonio Borneo
2024-02-15 21:03 ` [PATCH 00/13] irqchip: " Uwe Kleine-König
4 siblings, 1 reply; 9+ messages in thread
From: Uwe Kleine-König @ 2023-12-22 22:50 UTC (permalink / raw)
To: Thomas Gleixner
Cc: Maxime Coquelin, Alexandre Torgue, linux-kernel, linux-stm32,
linux-arm-kernel, kernel
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-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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [Linux-stm32] [PATCH 12/13] irqchip/stm32-exti: Convert to platform remove callback returning void
2023-12-22 22:50 ` [PATCH 12/13] irqchip/stm32-exti: " Uwe Kleine-König
@ 2023-12-24 11:59 ` Antonio Borneo
0 siblings, 0 replies; 9+ messages in thread
From: Antonio Borneo @ 2023-12-24 11:59 UTC (permalink / raw)
To: Uwe Kleine-König, Thomas Gleixner
Cc: Maxime Coquelin, linux-kernel, kernel, linux-stm32,
linux-arm-kernel
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 <u.kleine-koenig@pengutronix.de>
Reviewed-by: Antonio Borneo <antonio.borneo@foss.st.com>
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,
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 00/13] irqchip: Convert to platform remove callback returning void
2023-12-22 22:50 [PATCH 00/13] irqchip: Convert to platform remove callback returning void Uwe Kleine-König
` (3 preceding siblings ...)
2023-12-22 22:50 ` [PATCH 12/13] irqchip/stm32-exti: " Uwe Kleine-König
@ 2024-02-15 21:03 ` Uwe Kleine-König
2024-02-27 17:03 ` Thomas Gleixner
4 siblings, 1 reply; 9+ messages in thread
From: Uwe Kleine-König @ 2024-02-15 21:03 UTC (permalink / raw)
To: Thomas Gleixner
Cc: Andrew Lunn, alsa-devel, Charles Keepax, kernel, Shawn Guo,
Sascha Hauer, linux-stm32, linux-kernel, Alexandre Torgue,
Richard Fitzgerald, NXP Linux Team, Maxime Coquelin, patches,
Fabio Estevam, Gregory Clement, linux-arm-kernel,
Sebastian Hesselbarth
[-- Attachment #1.1: Type: text/plain, Size: 911 bytes --]
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/ |
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH 00/13] irqchip: Convert to platform remove callback returning void
2024-02-15 21:03 ` [PATCH 00/13] irqchip: " Uwe Kleine-König
@ 2024-02-27 17:03 ` Thomas Gleixner
0 siblings, 0 replies; 9+ messages in thread
From: Thomas Gleixner @ 2024-02-27 17:03 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Andrew Lunn, alsa-devel, Charles Keepax, kernel, Shawn Guo,
Sascha Hauer, linux-stm32, linux-kernel, Alexandre Torgue,
Richard Fitzgerald, NXP Linux Team, Maxime Coquelin, patches,
Fabio Estevam, Gregory Clement, linux-arm-kernel,
Sebastian Hesselbarth
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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 9+ messages in thread