media: meson: vdec: add missing clk_disable_unprepare on error in vdec_hevc_start()
authorXu Qiang <xuqiang36@huawei.com>
Thu, 18 Aug 2022 06:57:53 +0000 (08:57 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Oct 2022 10:35:06 +0000 (12:35 +0200)
[ Upstream commit 4029372233e13e281f8c387f279f9f064ced3810 ]

Add the missing clk_disable_unprepare() before return
from vdec_hevc_start() in the error handling case.

Fixes: 823a7300340e (“media: meson: vdec: add common HEVC decoder support”)
Signed-off-by: Xu Qiang <xuqiang36@huawei.com>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/staging/media/meson/vdec/vdec_hevc.c

index 9530e580e57a20e25bfc043cba4abc5c79907a43..afced435c9070240885970a82c40280b4c6fc6f5 100644 (file)
@@ -167,8 +167,12 @@ static int vdec_hevc_start(struct amvdec_session *sess)
 
        clk_set_rate(core->vdec_hevc_clk, 666666666);
        ret = clk_prepare_enable(core->vdec_hevc_clk);
-       if (ret)
+       if (ret) {
+               if (core->platform->revision == VDEC_REVISION_G12A ||
+                   core->platform->revision == VDEC_REVISION_SM1)
+                       clk_disable_unprepare(core->vdec_hevcf_clk);
                return ret;
+       }
 
        if (core->platform->revision == VDEC_REVISION_SM1)
                regmap_update_bits(core->regmap_ao, AO_RTI_GEN_PWR_SLEEP0,