diff mbox series

[31/32] power: supply: wm8350_power: Convert to platform remove callback returning void

Message ID 20230918133700.1254499-32-u.kleine-koenig@pengutronix.de
State Accepted
Commit 42720969f394dc074ce1c99cd0c425b7dd6017ee
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/wm8350_power.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/drivers/power/supply/wm8350_power.c b/drivers/power/supply/wm8350_power.c
index f2786761299c..f23b4f5343bc 100644
--- a/drivers/power/supply/wm8350_power.c
+++ b/drivers/power/supply/wm8350_power.c
@@ -579,7 +579,7 @@  static int wm8350_power_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int wm8350_power_remove(struct platform_device *pdev)
+static void wm8350_power_remove(struct platform_device *pdev)
 {
 	struct wm8350 *wm8350 = platform_get_drvdata(pdev);
 	struct wm8350_power *power = &wm8350->power;
@@ -589,12 +589,11 @@  static int wm8350_power_remove(struct platform_device *pdev)
 	power_supply_unregister(power->battery);
 	power_supply_unregister(power->ac);
 	power_supply_unregister(power->usb);
-	return 0;
 }
 
 static struct platform_driver wm8350_power_driver = {
 	.probe = wm8350_power_probe,
-	.remove = wm8350_power_remove,
+	.remove_new = wm8350_power_remove,
 	.driver = {
 		.name = "wm8350-power",
 	},