Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Input: sh_keysc - 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>
Link: https://lore.kernel.org/r/20230920125829.1478827-10-u.kleine-koenig@pengutronix.de
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Uwe Kleine-König and committed by
Dmitry Torokhov
e340089d 4e268589

+2 -4
+2 -4
drivers/input/keyboard/sh_keysc.c
··· 265 265 return error; 266 266 } 267 267 268 - static int sh_keysc_remove(struct platform_device *pdev) 268 + static void sh_keysc_remove(struct platform_device *pdev) 269 269 { 270 270 struct sh_keysc_priv *priv = platform_get_drvdata(pdev); 271 271 ··· 279 279 pm_runtime_disable(&pdev->dev); 280 280 281 281 kfree(priv); 282 - 283 - return 0; 284 282 } 285 283 286 284 static int sh_keysc_suspend(struct device *dev) ··· 319 321 320 322 static struct platform_driver sh_keysc_device_driver = { 321 323 .probe = sh_keysc_probe, 322 - .remove = sh_keysc_remove, 324 + .remove_new = sh_keysc_remove, 323 325 .driver = { 324 326 .name = "sh_keysc", 325 327 .pm = pm_sleep_ptr(&sh_keysc_dev_pm_ops),