Skip to content

Commit 4272096

Browse files
Uwe Kleine-Königsre
authored andcommitted
power: supply: wm8350_power: 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() 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> Link: https://lore.kernel.org/r/20230918133700.1254499-32-u.kleine-koenig@pengutronix.de Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
1 parent dab68bb commit 4272096

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

drivers/power/supply/wm8350_power.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ static int wm8350_power_probe(struct platform_device *pdev)
579579
return ret;
580580
}
581581

582-
static int wm8350_power_remove(struct platform_device *pdev)
582+
static void wm8350_power_remove(struct platform_device *pdev)
583583
{
584584
struct wm8350 *wm8350 = platform_get_drvdata(pdev);
585585
struct wm8350_power *power = &wm8350->power;
@@ -589,12 +589,11 @@ static int wm8350_power_remove(struct platform_device *pdev)
589589
power_supply_unregister(power->battery);
590590
power_supply_unregister(power->ac);
591591
power_supply_unregister(power->usb);
592-
return 0;
593592
}
594593

595594
static struct platform_driver wm8350_power_driver = {
596595
.probe = wm8350_power_probe,
597-
.remove = wm8350_power_remove,
596+
.remove_new = wm8350_power_remove,
598597
.driver = {
599598
.name = "wm8350-power",
600599
},

0 commit comments

Comments
 (0)