Skip to content

Commit 4280b30

Browse files
tititiou36gregkh
authored andcommitted
media: mtk-vpu: Fix a resource leak in the error handling path of 'mtk_vpu_probe()'
[ Upstream commit 2143ad4 ] A successful 'clk_prepare()' call should be balanced by a corresponding 'clk_unprepare()' call in the error handling path of the probe, as already done in the remove function. Update the error handling path accordingly. Fixes: 3003a18 ("[media] VPU: mediatek: support Mediatek VPU") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Reviewed-by: Houlong Wei <houlong.wei@mediatek.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent e43b301 commit 4280b30

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎drivers/media/platform/mtk-vpu/mtk_vpu.c‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,8 @@ static int mtk_vpu_probe(struct platform_device *pdev)
820820
vpu->wdt.wq = create_singlethread_workqueue("vpu_wdt");
821821
if (!vpu->wdt.wq) {
822822
dev_err(dev, "initialize wdt workqueue failed\n");
823-
return -ENOMEM;
823+
ret = -ENOMEM;
824+
goto clk_unprepare;
824825
}
825826
INIT_WORK(&vpu->wdt.ws, vpu_wdt_reset_func);
826827
mutex_init(&vpu->vpu_mutex);
@@ -914,6 +915,8 @@ static int mtk_vpu_probe(struct platform_device *pdev)
914915
vpu_clock_disable(vpu);
915916
workqueue_destroy:
916917
destroy_workqueue(vpu->wdt.wq);
918+
clk_unprepare:
919+
clk_unprepare(vpu->clk);
917920

918921
return ret;
919922
}

0 commit comments

Comments
 (0)