diff mbox series

[07/32] power: supply: charger-manager: Convert to platform remove callback returning void

Message ID 20230918133700.1254499-8-u.kleine-koenig@pengutronix.de
State Accepted
Commit 403eebf95c38302cacc48c127e575461f0e798be
Headers show
Series power: supply: Convert to platform remove callback returning void | expand

Commit Message

Uwe Kleine-König Sept. 18, 2023, 1:36 p.m. UTC
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() is 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>
 drivers/power/supply/charger-manager.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
diff mbox series


diff --git a/drivers/power/supply/charger-manager.c b/drivers/power/supply/charger-manager.c
index 5fa6ba7f41e1..3936ff066600 100644
--- a/drivers/power/supply/charger-manager.c
+++ b/drivers/power/supply/charger-manager.c
@@ -1628,7 +1628,7 @@  static int charger_manager_probe(struct platform_device *pdev)
 	return ret;
-static int charger_manager_remove(struct platform_device *pdev)
+static void charger_manager_remove(struct platform_device *pdev)
 	struct charger_manager *cm = platform_get_drvdata(pdev);
 	struct charger_desc *desc = cm->desc;
@@ -1648,8 +1648,6 @@  static int charger_manager_remove(struct platform_device *pdev)
 	try_charger_enable(cm, false);
-	return 0;
 static const struct platform_device_id charger_manager_id[] = {
@@ -1740,7 +1738,7 @@  static struct platform_driver charger_manager_driver = {
 		.of_match_table = charger_manager_match,
 	.probe = charger_manager_probe,
-	.remove = charger_manager_remove,
+	.remove_new = charger_manager_remove,
 	.id_table = charger_manager_id,