[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <6cb09965bce5bffe97fc00faecfffae9d3b38b3d.camel@mediatek.com>
Date: Fri, 20 Aug 2021 07:20:13 +0800
From: houlong wei <houlong.wei@...iatek.com>
To: Christophe JAILLET <christophe.jaillet@...adoo.fr>,
Minghsiu Tsai (蔡明修)
<Minghsiu.Tsai@...iatek.com>,
Andrew-CT Chen (陳智迪)
<Andrew-CT.Chen@...iatek.com>,
Tiffany Lin (林慧珊)
<tiffany.lin@...iatek.com>,
"mchehab@...nel.org" <mchehab@...nel.org>,
"matthias.bgg@...il.com" <matthias.bgg@...il.com>,
"hans.verkuil@...co.com" <hans.verkuil@...co.com>
CC: "linux-media@...r.kernel.org" <linux-media@...r.kernel.org>,
"linux-mediatek@...ts.infradead.org"
<linux-mediatek@...ts.infradead.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>,
<houlong.wei@...iatek.com>
Subject: Re: [PATCH] media: mtk-vpu: Fix a resource leak in the error
handling path of 'mtk_vpu_probe()'
On Fri, 2021-08-20 at 04:21 +0800, Christophe JAILLET wrote:
> 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: 3003a180ef6b ("[media] VPU: mediatek: support Mediatek VPU")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
> ---
>
Reviewed-by: Houlong Wei <houlong.wei@...iatek.com>
> drivers/media/platform/mtk-vpu/mtk_vpu.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/mtk-vpu/mtk_vpu.c
> b/drivers/media/platform/mtk-vpu/mtk_vpu.c
> index ec290dde59cf..7f1647da0ade 100644
> --- a/drivers/media/platform/mtk-vpu/mtk_vpu.c
> +++ b/drivers/media/platform/mtk-vpu/mtk_vpu.c
> @@ -848,7 +848,8 @@ static int mtk_vpu_probe(struct platform_device
> *pdev)
> vpu->wdt.wq = create_singlethread_workqueue("vpu_wdt");
> if (!vpu->wdt.wq) {
> dev_err(dev, "initialize wdt workqueue failed\n");
> - return -ENOMEM;
> + ret = -ENOMEM;
> + goto clk_unprepare;
> }
> INIT_WORK(&vpu->wdt.ws, vpu_wdt_reset_func);
> mutex_init(&vpu->vpu_mutex);
> @@ -942,6 +943,8 @@ static int mtk_vpu_probe(struct platform_device
> *pdev)
> vpu_clock_disable(vpu);
> workqueue_destroy:
> destroy_workqueue(vpu->wdt.wq);
> +clk_unprepare:
> + clk_unprepare(vpu->clk);
>
> return ret;
> }
> --
> 2.30.2
>
Powered by blists - more mailing lists