extcon: usbc-cros-ec: Convert to platform remove callback returning void
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Sun, 25 Feb 2024 15:54:56 +0000 (16:54 +0100)
committerChanwoo Choi <cw00.choi@samsung.com>
Wed, 8 May 2024 16:03:38 +0000 (01:03 +0900)
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.

Link: https://lore.kernel.org/lkml/52d0a4317d5372f1135259d4fbbd2822b86ba8f4.1708876186.git.u.kleine-koenig@pengutronix.de/
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
drivers/extcon/extcon-usbc-cros-ec.c

index fde1db62be0d9eb6ac4013f11f829bc0bf5b86f4..805a47230689d236fa8ca356ef797bf3794846db 100644 (file)
@@ -480,14 +480,12 @@ unregister_notifier:
        return ret;
 }
 
-static int extcon_cros_ec_remove(struct platform_device *pdev)
+static void extcon_cros_ec_remove(struct platform_device *pdev)
 {
        struct cros_ec_extcon_info *info = platform_get_drvdata(pdev);
 
        blocking_notifier_chain_unregister(&info->ec->event_notifier,
                                           &info->notifier);
-
-       return 0;
 }
 
 #ifdef CONFIG_PM_SLEEP
@@ -531,7 +529,7 @@ static struct platform_driver extcon_cros_ec_driver = {
                .of_match_table = of_match_ptr(extcon_cros_ec_of_match),
                .pm = DEV_PM_OPS,
        },
-       .remove  = extcon_cros_ec_remove,
+       .remove_new = extcon_cros_ec_remove,
        .probe   = extcon_cros_ec_probe,
 };