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>
This commit is contained in:
Zheng Yongjun 2022-03-17 13:16:13 +00:00 committed by Herbert Xu
parent c8bd296cca
commit e9a36feece
1 changed files with 3 additions and 1 deletions

View File

@ -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);