diff mbox series

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

Message ID 20230918133700.1254499-17-u.kleine-koenig@pengutronix.de
State Accepted
Commit 7810ba3c5110ce66652ec6bd2abb92da5d726c3b
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/lp8788-charger.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
diff mbox series


diff --git a/drivers/power/supply/lp8788-charger.c b/drivers/power/supply/lp8788-charger.c
index 755b6a4379b8..2c81be82a41a 100644
--- a/drivers/power/supply/lp8788-charger.c
+++ b/drivers/power/supply/lp8788-charger.c
@@ -714,20 +714,18 @@  static int lp8788_charger_probe(struct platform_device *pdev)
 	return 0;
-static int lp8788_charger_remove(struct platform_device *pdev)
+static void lp8788_charger_remove(struct platform_device *pdev)
 	struct lp8788_charger *pchg = platform_get_drvdata(pdev);
 	lp8788_irq_unregister(pdev, pchg);
-	return 0;
 static struct platform_driver lp8788_charger_driver = {
 	.probe = lp8788_charger_probe,
-	.remove = lp8788_charger_remove,
+	.remove_new = lp8788_charger_remove,
 	.driver = {
 		.name = LP8788_DEV_CHARGER,