Skip to content

Commit 03560ff

Browse files
Uwe Kleine-Königbroonie
authored andcommitted
regulator: arizona-ldo1: 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() will be 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://msgid.link/r/76c7af01e2c8b3ab6585a04bc3f0d163fbb7fdf7.1701778038.git.u.kleine-koenig@pengutronix.de Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com> Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 2506c1d commit 03560ff

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

drivers/regulator/arizona-ldo1.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -339,14 +339,12 @@ static int arizona_ldo1_probe(struct platform_device *pdev)
339339
return ret;
340340
}
341341

342-
static int arizona_ldo1_remove(struct platform_device *pdev)
342+
static void arizona_ldo1_remove(struct platform_device *pdev)
343343
{
344344
struct arizona_ldo1 *ldo1 = platform_get_drvdata(pdev);
345345

346346
if (ldo1->ena_gpiod)
347347
gpiod_put(ldo1->ena_gpiod);
348-
349-
return 0;
350348
}
351349

352350
static int madera_ldo1_probe(struct platform_device *pdev)
@@ -377,7 +375,7 @@ static int madera_ldo1_probe(struct platform_device *pdev)
377375

378376
static struct platform_driver arizona_ldo1_driver = {
379377
.probe = arizona_ldo1_probe,
380-
.remove = arizona_ldo1_remove,
378+
.remove_new = arizona_ldo1_remove,
381379
.driver = {
382380
.name = "arizona-ldo1",
383381
.probe_type = PROBE_FORCE_SYNCHRONOUS,
@@ -386,7 +384,7 @@ static struct platform_driver arizona_ldo1_driver = {
386384

387385
static struct platform_driver madera_ldo1_driver = {
388386
.probe = madera_ldo1_probe,
389-
.remove = arizona_ldo1_remove,
387+
.remove_new = arizona_ldo1_remove,
390388
.driver = {
391389
.name = "madera-ldo1",
392390
.probe_type = PROBE_FORCE_SYNCHRONOUS,

0 commit comments

Comments
 (0)