Skip to content

Commit e9a36fe

Browse files
Zheng Yongjunherbertx
authored andcommitted
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>
1 parent c8bd296 commit e9a36fe

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/crypto/stm32/stm32-crc32.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,8 +384,10 @@ static int stm32_crc_remove(struct platform_device *pdev)
384384
struct stm32_crc *crc = platform_get_drvdata(pdev);
385385
int ret = pm_runtime_get_sync(crc->dev);
386386

387-
if (ret < 0)
387+
if (ret < 0) {
388+
pm_runtime_put_noidle(crc->dev);
388389
return ret;
390+
}
389391

390392
spin_lock(&crc_list.lock);
391393
list_del(&crc->list);

0 commit comments

Comments
 (0)