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

power: supply: rx51_battery: 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-24-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
9f0da40a 325cb83b

+2 -4
+2 -4
drivers/power/supply/rx51_battery.c
··· 246 246 return ret; 247 247 } 248 248 249 - static int rx51_battery_remove(struct platform_device *pdev) 249 + static void rx51_battery_remove(struct platform_device *pdev) 250 250 { 251 251 struct rx51_device_info *di = platform_get_drvdata(pdev); 252 252 ··· 255 255 iio_channel_release(di->channel_vbat); 256 256 iio_channel_release(di->channel_bsi); 257 257 iio_channel_release(di->channel_temp); 258 - 259 - return 0; 260 258 } 261 259 262 260 #ifdef CONFIG_OF ··· 267 269 268 270 static struct platform_driver rx51_battery_driver = { 269 271 .probe = rx51_battery_probe, 270 - .remove = rx51_battery_remove, 272 + .remove_new = rx51_battery_remove, 271 273 .driver = { 272 274 .name = "rx51-battery", 273 275 .of_match_table = of_match_ptr(n900_battery_of_match),