Message ID | 20230920125829.1478827-53-u.kleine-koenig@pengutronix.de (mailing list archive) |
---|---|
State | Mainlined |
Commit | c50fdc48643a25f5218f6b8bba4f28e1b4a94708 |
Headers | show |
Series | input: Convert to platform remove callback returning void | expand |
On Wed, Sep 20, 2023 at 02:58:29PM +0200, 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> > --- Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com> Thanks, Charles
diff --git a/drivers/input/touchscreen/wm97xx-core.c b/drivers/input/touchscreen/wm97xx-core.c index ac3b3dd59488..f01f6cc9b59f 100644 --- a/drivers/input/touchscreen/wm97xx-core.c +++ b/drivers/input/touchscreen/wm97xx-core.c @@ -756,11 +756,9 @@ static int wm97xx_mfd_probe(struct platform_device *pdev) return ret; } -static int wm97xx_mfd_remove(struct platform_device *pdev) +static void wm97xx_mfd_remove(struct platform_device *pdev) { wm97xx_remove(&pdev->dev); - - return 0; } static int wm97xx_suspend(struct device *dev) @@ -878,7 +876,7 @@ static struct platform_driver wm97xx_mfd_driver = { .pm = pm_sleep_ptr(&wm97xx_pm_ops), }, .probe = wm97xx_mfd_probe, - .remove = wm97xx_mfd_remove, + .remove_new = wm97xx_mfd_remove, }; static int __init wm97xx_init(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> --- drivers/input/touchscreen/wm97xx-core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)