Input: i8042 - convert to platform remove callback returning void
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Wed, 20 Sep 2023 12:58:12 +0000 (14:58 +0200)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Sun, 24 Sep 2023 02:28:13 +0000 (19:28 -0700)
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-36-u.kleine-koenig@pengutronix.de
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/serio/i8042.c

index 6dac7c1853a54189f50784b85b5ae3eaf9b6b93e..9fbb8d31575ae1486afcb1e7f70e51ff8d6f5a76 100644 (file)
@@ -1584,13 +1584,11 @@ static int i8042_probe(struct platform_device *dev)
        return error;
 }
 
-static int i8042_remove(struct platform_device *dev)
+static void i8042_remove(struct platform_device *dev)
 {
        i8042_unregister_ports();
        i8042_free_irqs();
        i8042_controller_reset(false);
-
-       return 0;
 }
 
 static struct platform_driver i8042_driver = {
@@ -1601,7 +1599,7 @@ static struct platform_driver i8042_driver = {
 #endif
        },
        .probe          = i8042_probe,
-       .remove         = i8042_remove,
+       .remove_new     = i8042_remove,
        .shutdown       = i8042_shutdown,
 };