counter: ti-eqep: Convert to platform remove callback returning void
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Sun, 10 Mar 2024 08:06:07 +0000 (09:06 +0100)
committerWilliam Breathitt Gray <wbg@kernel.org>
Tue, 2 Apr 2024 17:10:35 +0000 (13:10 -0400)
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: David Lechner <david@lechnology.com>
Link: https://lore.kernel.org/r/bf78595f6a49be0b6bb403b466c13177d72c02b7.1710057753.git.u.kleine-koenig@pengutronix.de
Signed-off-by: William Breathitt Gray <wbg@kernel.org>
drivers/counter/ti-eqep.c

index b0f24cf3e891dedd8295bc43c79e4f1403e1bd72..072b11fd6b32e8084de86d2da81dd4ef10da642e 100644 (file)
@@ -425,7 +425,7 @@ static int ti_eqep_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int ti_eqep_remove(struct platform_device *pdev)
+static void ti_eqep_remove(struct platform_device *pdev)
 {
        struct counter_device *counter = platform_get_drvdata(pdev);
        struct device *dev = &pdev->dev;
@@ -433,8 +433,6 @@ static int ti_eqep_remove(struct platform_device *pdev)
        counter_unregister(counter);
        pm_runtime_put_sync(dev);
        pm_runtime_disable(dev);
-
-       return 0;
 }
 
 static const struct of_device_id ti_eqep_of_match[] = {
@@ -445,7 +443,7 @@ MODULE_DEVICE_TABLE(of, ti_eqep_of_match);
 
 static struct platform_driver ti_eqep_driver = {
        .probe = ti_eqep_probe,
-       .remove = ti_eqep_remove,
+       .remove_new = ti_eqep_remove,
        .driver = {
                .name = "ti-eqep-cnt",
                .of_match_table = ti_eqep_of_match,