Skip to content

Commit e453a3e

Browse files
Uwe Kleine-Königdtor
authored andcommitted
Input: sun4i-ps2 - 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 <[email protected]> Acked-by: Jernej Skrabec <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent d4904ad commit e453a3e

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/input/serio/sun4i-ps2.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ static int sun4i_ps2_probe(struct platform_device *pdev)
297297
return error;
298298
}
299299

300-
static int sun4i_ps2_remove(struct platform_device *pdev)
300+
static void sun4i_ps2_remove(struct platform_device *pdev)
301301
{
302302
struct sun4i_ps2data *drvdata = platform_get_drvdata(pdev);
303303

@@ -311,8 +311,6 @@ static int sun4i_ps2_remove(struct platform_device *pdev)
311311
iounmap(drvdata->reg_base);
312312

313313
kfree(drvdata);
314-
315-
return 0;
316314
}
317315

318316
static const struct of_device_id sun4i_ps2_match[] = {
@@ -324,7 +322,7 @@ MODULE_DEVICE_TABLE(of, sun4i_ps2_match);
324322

325323
static struct platform_driver sun4i_ps2_driver = {
326324
.probe = sun4i_ps2_probe,
327-
.remove = sun4i_ps2_remove,
325+
.remove_new = sun4i_ps2_remove,
328326
.driver = {
329327
.name = DRIVER_NAME,
330328
.of_match_table = sun4i_ps2_match,

0 commit comments

Comments
 (0)