diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2024-02-25 16:54:56 +0100 |
---|---|---|
committer | Chanwoo Choi <cw00.choi@samsung.com> | 2024-05-09 01:03:38 +0900 |
commit | bff3f0e3035056e5b28b3d3817752c1e5f56b5bc (patch) | |
tree | eac527ec12f80de95167b0c514809d6a2bfc7dfd | |
parent | 5be3dfe6e5f8834e5793a75983be827b4294ae43 (diff) | |
download | linux-bff3f0e3035056e5b28b3d3817752c1e5f56b5bc.tar.gz linux-bff3f0e3035056e5b28b3d3817752c1e5f56b5bc.tar.bz2 linux-bff3f0e3035056e5b28b3d3817752c1e5f56b5bc.zip |
extcon: usbc-cros-ec: 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.
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>
-rw-r--r-- | drivers/extcon/extcon-usbc-cros-ec.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/extcon/extcon-usbc-cros-ec.c b/drivers/extcon/extcon-usbc-cros-ec.c index fde1db62be0d..805a47230689 100644 --- a/drivers/extcon/extcon-usbc-cros-ec.c +++ b/drivers/extcon/extcon-usbc-cros-ec.c @@ -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, }; |