Skip to content

Commit 6f9fb8a

Browse files
Uwe Kleine-Königsre
authored andcommitted
power: supply: wm97xx_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-33-u.kleine-koenig@pengutronix.de Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
1 parent 4272096 commit 6f9fb8a

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

drivers/power/supply/wm97xx_battery.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,14 +248,13 @@ static int wm97xx_bat_probe(struct platform_device *dev)
248248
return ret;
249249
}
250250

251-
static int wm97xx_bat_remove(struct platform_device *dev)
251+
static void wm97xx_bat_remove(struct platform_device *dev)
252252
{
253253
if (charge_gpiod)
254254
free_irq(gpiod_to_irq(charge_gpiod), dev);
255255
cancel_work_sync(&bat_work);
256256
power_supply_unregister(bat_psy);
257257
kfree(prop);
258-
return 0;
259258
}
260259

261260
static struct platform_driver wm97xx_bat_driver = {
@@ -266,7 +265,7 @@ static struct platform_driver wm97xx_bat_driver = {
266265
#endif
267266
},
268267
.probe = wm97xx_bat_probe,
269-
.remove = wm97xx_bat_remove,
268+
.remove_new = wm97xx_bat_remove,
270269
};
271270

272271
module_platform_driver(wm97xx_bat_driver);

0 commit comments

Comments
 (0)