Skip to content

Commit 541b071

Browse files
Uwe Kleine-Königherbertx
authored andcommitted
hwrng: stm32 - 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> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 4da4a48 commit 541b071

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/char/hw_random/stm32-rng.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -363,11 +363,9 @@ static int stm32_rng_init(struct hwrng *rng)
363363
return 0;
364364
}
365365

366-
static int stm32_rng_remove(struct platform_device *ofdev)
366+
static void stm32_rng_remove(struct platform_device *ofdev)
367367
{
368368
pm_runtime_disable(&ofdev->dev);
369-
370-
return 0;
371369
}
372370

373371
static int __maybe_unused stm32_rng_runtime_suspend(struct device *dev)
@@ -558,7 +556,7 @@ static struct platform_driver stm32_rng_driver = {
558556
.of_match_table = stm32_rng_match,
559557
},
560558
.probe = stm32_rng_probe,
561-
.remove = stm32_rng_remove,
559+
.remove_new = stm32_rng_remove,
562560
};
563561

564562
module_platform_driver(stm32_rng_driver);

0 commit comments

Comments
 (0)