提交 12dca110 编写于 作者: C Christophe JAILLET 提交者: Zheng Zengkai

media: venus: core: Fix some resource leaks in the error path of 'venus_probe()'

stable inclusion
from stable-5.10.37
commit 00b68a7478343afdf83f30c43e64db5296057030
bugzilla: 51868
CVE: NA

--------------------------------

[ Upstream commit 5a465c53 ]

If an error occurs after a successful 'of_icc_get()' call, it must be
undone.

Use 'devm_of_icc_get()' instead of 'of_icc_get()' to avoid the leak.
Update the remove function accordingly and axe the now unneeded
'icc_put()' calls.

Fixes: 32f0a6dd ("media: venus: Use on-chip interconnect API")
Signed-off-by: NChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: NStanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 6709f99e
无相关合并请求
......@@ -195,11 +195,11 @@ static int venus_probe(struct platform_device *pdev)
if (IS_ERR(core->base))
return PTR_ERR(core->base);
core->video_path = of_icc_get(dev, "video-mem");
core->video_path = devm_of_icc_get(dev, "video-mem");
if (IS_ERR(core->video_path))
return PTR_ERR(core->video_path);
core->cpucfg_path = of_icc_get(dev, "cpu-cfg");
core->cpucfg_path = devm_of_icc_get(dev, "cpu-cfg");
if (IS_ERR(core->cpucfg_path))
return PTR_ERR(core->cpucfg_path);
......@@ -334,9 +334,6 @@ static int venus_remove(struct platform_device *pdev)
hfi_destroy(core);
icc_put(core->video_path);
icc_put(core->cpucfg_path);
v4l2_device_unregister(&core->v4l2_dev);
mutex_destroy(&core->pm_lock);
mutex_destroy(&core->lock);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册