Skip to content

Commit 6e3ed20

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

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

drivers/power/supply/pcf50633-charger.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ static int pcf50633_mbc_probe(struct platform_device *pdev)
441441
return 0;
442442
}
443443

444-
static int pcf50633_mbc_remove(struct platform_device *pdev)
444+
static void pcf50633_mbc_remove(struct platform_device *pdev)
445445
{
446446
struct pcf50633_mbc *mbc = platform_get_drvdata(pdev);
447447
int i;
@@ -453,16 +453,14 @@ static int pcf50633_mbc_remove(struct platform_device *pdev)
453453
power_supply_unregister(mbc->usb);
454454
power_supply_unregister(mbc->adapter);
455455
power_supply_unregister(mbc->ac);
456-
457-
return 0;
458456
}
459457

460458
static struct platform_driver pcf50633_mbc_driver = {
461459
.driver = {
462460
.name = "pcf50633-mbc",
463461
},
464462
.probe = pcf50633_mbc_probe,
465-
.remove = pcf50633_mbc_remove,
463+
.remove_new = pcf50633_mbc_remove,
466464
};
467465

468466
module_platform_driver(pcf50633_mbc_driver);

0 commit comments

Comments
 (0)