Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

power: supply: ab8500_charger: 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-4-u.kleine-koenig@pengutronix.de
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

authored by

Uwe Kleine-König and committed by
Sebastian Reichel
c5b08e1b 465ec888

+2 -4
+2 -4
drivers/power/supply/ab8500_charger.c
··· 3679 3679 return ret; 3680 3680 } 3681 3681 3682 - static int ab8500_charger_remove(struct platform_device *pdev) 3682 + static void ab8500_charger_remove(struct platform_device *pdev) 3683 3683 { 3684 3684 struct ab8500_charger *di = platform_get_drvdata(pdev); 3685 3685 ··· 3688 3688 usb_unregister_notifier(di->usb_phy, &di->nb); 3689 3689 ab8500_bm_of_remove(di->usb_chg.psy, di->bm); 3690 3690 usb_put_phy(di->usb_phy); 3691 - 3692 - return 0; 3693 3691 } 3694 3692 3695 3693 static SIMPLE_DEV_PM_OPS(ab8500_charger_pm_ops, ab8500_charger_suspend, ab8500_charger_resume); ··· 3700 3702 3701 3703 static struct platform_driver ab8500_charger_driver = { 3702 3704 .probe = ab8500_charger_probe, 3703 - .remove = ab8500_charger_remove, 3705 + .remove_new = ab8500_charger_remove, 3704 3706 .driver = { 3705 3707 .name = "ab8500-charger", 3706 3708 .of_match_table = ab8500_charger_match,