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

power: supply: twl4030_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-28-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
83ef1dbc 07a93989

+2 -4
+2 -4
drivers/power/supply/twl4030_charger.c
··· 1108 1108 return 0; 1109 1109 } 1110 1110 1111 - static int twl4030_bci_remove(struct platform_device *pdev) 1111 + static void twl4030_bci_remove(struct platform_device *pdev) 1112 1112 { 1113 1113 struct twl4030_bci *bci = platform_get_drvdata(pdev); 1114 1114 ··· 1123 1123 TWL4030_INTERRUPTS_BCIIMR1A); 1124 1124 twl_i2c_write_u8(TWL4030_MODULE_INTERRUPTS, 0xff, 1125 1125 TWL4030_INTERRUPTS_BCIIMR2A); 1126 - 1127 - return 0; 1128 1126 } 1129 1127 1130 1128 static const struct of_device_id twl_bci_of_match[] __maybe_unused = { ··· 1133 1135 1134 1136 static struct platform_driver twl4030_bci_driver = { 1135 1137 .probe = twl4030_bci_probe, 1136 - .remove = twl4030_bci_remove, 1138 + .remove_new = twl4030_bci_remove, 1137 1139 .driver = { 1138 1140 .name = "twl4030_bci", 1139 1141 .of_match_table = of_match_ptr(twl_bci_of_match),