Skip to content

Commit 21c3c27

Browse files
Uwe Kleine-Königdtor
authored andcommitted
Input: ps2-gpio - 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-40-u.kleine-koenig@pengutronix.de Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent 9c3c167 commit 21c3c27

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

drivers/input/serio/ps2-gpio.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -476,12 +476,11 @@ static int ps2_gpio_probe(struct platform_device *pdev)
476476
return error;
477477
}
478478

479-
static int ps2_gpio_remove(struct platform_device *pdev)
479+
static void ps2_gpio_remove(struct platform_device *pdev)
480480
{
481481
struct ps2_gpio_data *drvdata = platform_get_drvdata(pdev);
482482

483483
serio_unregister_port(drvdata->serio);
484-
return 0;
485484
}
486485

487486
#if defined(CONFIG_OF)
@@ -494,7 +493,7 @@ MODULE_DEVICE_TABLE(of, ps2_gpio_match);
494493

495494
static struct platform_driver ps2_gpio_driver = {
496495
.probe = ps2_gpio_probe,
497-
.remove = ps2_gpio_remove,
496+
.remove_new = ps2_gpio_remove,
498497
.driver = {
499498
.name = DRIVER_NAME,
500499
.of_match_table = of_match_ptr(ps2_gpio_match),

0 commit comments

Comments
 (0)