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

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>

authored by

Uwe Kleine-König and committed by
Sebastian Reichel
6e3ed20e 026f25f2

+2 -4
+2 -4
drivers/power/supply/pcf50633-charger.c
··· 441 441 return 0; 442 442 } 443 443 444 - static int pcf50633_mbc_remove(struct platform_device *pdev) 444 + static void pcf50633_mbc_remove(struct platform_device *pdev) 445 445 { 446 446 struct pcf50633_mbc *mbc = platform_get_drvdata(pdev); 447 447 int i; ··· 453 453 power_supply_unregister(mbc->usb); 454 454 power_supply_unregister(mbc->adapter); 455 455 power_supply_unregister(mbc->ac); 456 - 457 - return 0; 458 456 } 459 457 460 458 static struct platform_driver pcf50633_mbc_driver = { ··· 460 462 .name = "pcf50633-mbc", 461 463 }, 462 464 .probe = pcf50633_mbc_probe, 463 - .remove = pcf50633_mbc_remove, 465 + .remove_new = pcf50633_mbc_remove, 464 466 }; 465 467 466 468 module_platform_driver(pcf50633_mbc_driver);