linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: houlong wei <houlong.wei@mediatek.com>
To: "Christophe JAILLET" <christophe.jaillet@wanadoo.fr>,
	"Minghsiu Tsai (蔡明修)" <Minghsiu.Tsai@mediatek.com>,
	"Andrew-CT Chen (陳智迪)" <Andrew-CT.Chen@mediatek.com>,
	"Tiffany Lin (林慧珊)" <tiffany.lin@mediatek.com>,
	"mchehab@kernel.org" <mchehab@kernel.org>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"hans.verkuil@cisco.com" <hans.verkuil@cisco.com>
Cc: "linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
	"linux-mediatek@lists.infradead.org" 
	<linux-mediatek@lists.infradead.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"kernel-janitors@vger.kernel.org"
	<kernel-janitors@vger.kernel.org>, <houlong.wei@mediatek.com>
Subject: Re: [PATCH] media: mtk-vpu: Fix a resource leak in the error handling path of 'mtk_vpu_probe()'
Date: Fri, 20 Aug 2021 07:20:13 +0800	[thread overview]
Message-ID: <6cb09965bce5bffe97fc00faecfffae9d3b38b3d.camel@mediatek.com> (raw)
In-Reply-To: <3d4ba5d254044567653a006b18971658ec69560f.1629404378.git.christophe.jaillet@wanadoo.fr>

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@wanadoo.fr>
> ---
> 
Reviewed-by: Houlong Wei <houlong.wei@mediatek.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
> 

      reply	other threads:[~2021-08-19 23:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-19 20:21 [PATCH] media: mtk-vpu: Fix a resource leak in the error handling path of 'mtk_vpu_probe()' Christophe JAILLET
2021-08-19 23:20 ` houlong wei [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6cb09965bce5bffe97fc00faecfffae9d3b38b3d.camel@mediatek.com \
    --to=houlong.wei@mediatek.com \
    --cc=Andrew-CT.Chen@mediatek.com \
    --cc=Minghsiu.Tsai@mediatek.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=hans.verkuil@cisco.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=mchehab@kernel.org \
    --cc=tiffany.lin@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).