Skip to content

Commit 9f0da40

Browse files
Uwe Kleine-Königsre
authored andcommitted
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>
1 parent 325cb83 commit 9f0da40

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

drivers/power/supply/rx51_battery.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ static int rx51_battery_probe(struct platform_device *pdev)
246246
return ret;
247247
}
248248

249-
static int rx51_battery_remove(struct platform_device *pdev)
249+
static void rx51_battery_remove(struct platform_device *pdev)
250250
{
251251
struct rx51_device_info *di = platform_get_drvdata(pdev);
252252

@@ -255,8 +255,6 @@ static int rx51_battery_remove(struct platform_device *pdev)
255255
iio_channel_release(di->channel_vbat);
256256
iio_channel_release(di->channel_bsi);
257257
iio_channel_release(di->channel_temp);
258-
259-
return 0;
260258
}
261259

262260
#ifdef CONFIG_OF
@@ -269,7 +267,7 @@ MODULE_DEVICE_TABLE(of, n900_battery_of_match);
269267

270268
static struct platform_driver rx51_battery_driver = {
271269
.probe = rx51_battery_probe,
272-
.remove = rx51_battery_remove,
270+
.remove_new = rx51_battery_remove,
273271
.driver = {
274272
.name = "rx51-battery",
275273
.of_match_table = of_match_ptr(n900_battery_of_match),

0 commit comments

Comments
 (0)