diff options
author | Zheng Yongjun <zhengyongjun3@huawei.com> | 2022-03-17 13:16:13 +0000 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2022-03-25 16:21:05 +1200 |
commit | e9a36feecee0ee5845f2e0656f50f9942dd0bed3 (patch) | |
tree | 18358bac15de12fca95982db6be2c252597349e1 | |
parent | c8bd296cca3434b13b28b074eaeb78a23284de77 (diff) | |
download | linux-e9a36feecee0ee5845f2e0656f50f9942dd0bed3.tar.bz2 |
crypto: stm32 - fix reference leak in stm32_crc_remove
pm_runtime_get_sync() will increment pm usage counter even it
failed. Forgetting to call pm_runtime_put_noidle will result
in reference leak in stm32_crc_remove, so we should fix it.
Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r-- | drivers/crypto/stm32/stm32-crc32.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/crypto/stm32/stm32-crc32.c b/drivers/crypto/stm32/stm32-crc32.c index be1bf39a317d..90a920e7f664 100644 --- a/drivers/crypto/stm32/stm32-crc32.c +++ b/drivers/crypto/stm32/stm32-crc32.c @@ -384,8 +384,10 @@ static int stm32_crc_remove(struct platform_device *pdev) struct stm32_crc *crc = platform_get_drvdata(pdev); int ret = pm_runtime_get_sync(crc->dev); - if (ret < 0) + if (ret < 0) { + pm_runtime_put_noidle(crc->dev); return ret; + } spin_lock(&crc_list.lock); list_del(&crc->list); |