[Linux-stm32] [PATCH 12/13] irqchip/stm32-exti: Convert to platform remove callback returning void
Antonio Borneo
antonio.borneo at foss.st.com
Sun Dec 24 03:59:58 PST 2023
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 at pengutronix.de>
Reviewed-by: Antonio Borneo <antonio.borneo at 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,
More information about the linux-arm-kernel
mailing list