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

Commit 91d1f8ae authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Greg Kroah-Hartman
Browse files

media: mtk-vpu: Fix a resource leak in the error handling path of 'mtk_vpu_probe()'



[ Upstream commit 2143ad413c05c7be24c3a92760e367b7f6aaac92 ]

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: 3003a180 ("[media] VPU: mediatek: support Mediatek VPU")
Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: default avatarHoulong Wei <houlong.wei@mediatek.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent caacdefc
Loading
Loading
Loading
Loading
+4 −1
Original line number Original line Diff line number Diff line
@@ -818,7 +818,8 @@ static int mtk_vpu_probe(struct platform_device *pdev)
	vpu->wdt.wq = create_singlethread_workqueue("vpu_wdt");
	vpu->wdt.wq = create_singlethread_workqueue("vpu_wdt");
	if (!vpu->wdt.wq) {
	if (!vpu->wdt.wq) {
		dev_err(dev, "initialize wdt workqueue failed\n");
		dev_err(dev, "initialize wdt workqueue failed\n");
		return -ENOMEM;
		ret = -ENOMEM;
		goto clk_unprepare;
	}
	}
	INIT_WORK(&vpu->wdt.ws, vpu_wdt_reset_func);
	INIT_WORK(&vpu->wdt.ws, vpu_wdt_reset_func);
	mutex_init(&vpu->vpu_mutex);
	mutex_init(&vpu->vpu_mutex);
@@ -917,6 +918,8 @@ static int mtk_vpu_probe(struct platform_device *pdev)
	vpu_clock_disable(vpu);
	vpu_clock_disable(vpu);
workqueue_destroy:
workqueue_destroy:
	destroy_workqueue(vpu->wdt.wq);
	destroy_workqueue(vpu->wdt.wq);
clk_unprepare:
	clk_unprepare(vpu->clk);


	return ret;
	return ret;
}
}