Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f0213894 authored by Zheng Yongjun's avatar Zheng Yongjun Committed by Greg Kroah-Hartman
Browse files

crypto: stm32 - fix reference leak in stm32_crc_remove



[ Upstream commit e9a36feecee0ee5845f2e0656f50f9942dd0bed3 ]

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: default avatarZheng Yongjun <zhengyongjun3@huawei.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 8c015cd5
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -332,8 +332,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);