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

crypto: 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() 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>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Uwe Kleine-König and committed by
Herbert Xu
7f1045c6 3feec4ef

+2 -4
+2 -4
drivers/crypto/stm32/stm32-hash.c
··· 2112 2112 return ret; 2113 2113 } 2114 2114 2115 - static int stm32_hash_remove(struct platform_device *pdev) 2115 + static void stm32_hash_remove(struct platform_device *pdev) 2116 2116 { 2117 2117 struct stm32_hash_dev *hdev = platform_get_drvdata(pdev); 2118 2118 int ret; ··· 2135 2135 2136 2136 if (ret >= 0) 2137 2137 clk_disable_unprepare(hdev->clk); 2138 - 2139 - return 0; 2140 2138 } 2141 2139 2142 2140 #ifdef CONFIG_PM ··· 2171 2173 2172 2174 static struct platform_driver stm32_hash_driver = { 2173 2175 .probe = stm32_hash_probe, 2174 - .remove = stm32_hash_remove, 2176 + .remove_new = stm32_hash_remove, 2175 2177 .driver = { 2176 2178 .name = "stm32-hash", 2177 2179 .pm = &stm32_hash_pm_ops,