diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2024-03-06 22:19:47 +0100 |
---|---|---|
committer | John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> | 2024-05-02 12:02:22 +0200 |
commit | 5019cd6114e7f3089db382d2a38a2263f0a4d004 (patch) | |
tree | ddb983c850448e1954bce0695d3d7c0940b20ce0 /arch/sh | |
parent | sh: sh7785lcr: Make init_sh7785lcr_IRQ() static (diff) | |
download | linux-5019cd6114e7f3089db382d2a38a2263f0a4d004.tar.xz linux-5019cd6114e7f3089db382d2a38a2263f0a4d004.zip |
sh: push-switch: Convert to platform remove callback returning void
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: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Link: https://lore.kernel.org/r/20240306211947.97103-2-u.kleine-koenig@pengutronix.de
Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Diffstat (limited to 'arch/sh')
-rw-r--r-- | arch/sh/drivers/push-switch.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/arch/sh/drivers/push-switch.c b/arch/sh/drivers/push-switch.c index 6ecba5f521eb..362e4860bf52 100644 --- a/arch/sh/drivers/push-switch.c +++ b/arch/sh/drivers/push-switch.c @@ -91,7 +91,7 @@ err: return ret; } -static int switch_drv_remove(struct platform_device *pdev) +static void switch_drv_remove(struct platform_device *pdev) { struct push_switch *psw = platform_get_drvdata(pdev); struct push_switch_platform_info *psw_info = pdev->dev.platform_data; @@ -106,13 +106,11 @@ static int switch_drv_remove(struct platform_device *pdev) free_irq(irq, pdev); kfree(psw); - - return 0; } static struct platform_driver switch_driver = { .probe = switch_drv_probe, - .remove = switch_drv_remove, + .remove_new = switch_drv_remove, .driver = { .name = DRV_NAME, }, |