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

crypto: exynos-rng - 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>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Uwe Kleine-König and committed by
Herbert Xu
b0d49b30 e7edfb41

+2 -4
+2 -4
drivers/crypto/exynos-rng.c
··· 306 306 return ret; 307 307 } 308 308 309 - static int exynos_rng_remove(struct platform_device *pdev) 309 + static void exynos_rng_remove(struct platform_device *pdev) 310 310 { 311 311 crypto_unregister_rng(&exynos_rng_alg); 312 312 313 313 exynos_rng_dev = NULL; 314 - 315 - return 0; 316 314 } 317 315 318 316 static int __maybe_unused exynos_rng_suspend(struct device *dev) ··· 389 391 .of_match_table = exynos_rng_dt_match, 390 392 }, 391 393 .probe = exynos_rng_probe, 392 - .remove = exynos_rng_remove, 394 + .remove_new = exynos_rng_remove, 393 395 }; 394 396 395 397 module_platform_driver(exynos_rng_driver);