[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0e586f3d05a03bd5d9a8bfead55162e14a6aa4de.camel@foss.st.com>
Date: Sun, 24 Dec 2023 12:59:58 +0100
From: Antonio Borneo <antonio.borneo@...s.st.com>
To: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>,
Thomas Gleixner <tglx@...utronix.de>
CC: Maxime Coquelin <mcoquelin.stm32@...il.com>,
<linux-kernel@...r.kernel.org>, <kernel@...gutronix.de>,
<linux-stm32@...md-mailman.stormreply.com>,
<linux-arm-kernel@...ts.infradead.org>
Subject: Re: [Linux-stm32] [PATCH 12/13] irqchip/stm32-exti: Convert to
platform remove callback returning void
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@...gutronix.de>
Reviewed-by: Antonio Borneo <antonio.borneo@...s.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,
Powered by blists - more mailing lists