linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: houlong wei <houlong.wei@mediatek.com>
To: Nishka Dasgupta <nishkadg.linux@gmail.com>
Cc: "Andrew-CT Chen (陳智迪)" <Andrew-CT.Chen@mediatek.com>,
	"Minghsiu Tsai (蔡明修)" <Minghsiu.Tsai@mediatek.com>,
	houlong.wei@mediatek.com,
	"linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"mchehab@kernel.org" <mchehab@kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>
Subject: Re: [PATCH] media: platform: mtk-mdp: mtk_mdp_core: Add of_node_put() before goto
Date: Fri, 12 Jul 2019 15:37:12 +0800	[thread overview]
Message-ID: <1562917032.29653.7.camel@mhfsdcap03> (raw)
In-Reply-To: <20190709172454.13648-1-nishkadg.linux@gmail.com>

On Wed, 2019-07-10 at 01:24 +0800, Nishka Dasgupta wrote:
> Each iteration of for_each_child_of_node puts the previous node, but in
> the case of a goto from the middle of the loop, there is no put, thus
> causing a memory leak. Hence add an of_node_put before the goto in two
> places.
> Issue found with Coccinelle.
> 
> Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
> ---
>  drivers/media/platform/mtk-mdp/mtk_mdp_core.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_core.c b/drivers/media/platform/mtk-mdp/mtk_mdp_core.c
> index fc9faec85edb..d0a3f06ad83d 100644
> --- a/drivers/media/platform/mtk-mdp/mtk_mdp_core.c
> +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_core.c
> @@ -145,13 +145,16 @@ static int mtk_mdp_probe(struct platform_device *pdev)
>  		comp = devm_kzalloc(dev, sizeof(*comp), GFP_KERNEL);
>  		if (!comp) {
>  			ret = -ENOMEM;
> +			of_node_put(node);
>  			goto err_comp;
>  		}
>  		mdp->comp[comp_id] = comp;
>  
>  		ret = mtk_mdp_comp_init(dev, node, comp, comp_id);
> -		if (ret)
> +		if (ret) {
> +			of_node_put(node);
>  			goto err_comp;
> +		}
>  	}
>  
>  	mdp->job_wq = create_singlethread_workqueue(MTK_MDP_MODULE_NAME);

Thanks Nishka for fixing the bug.

Acked-by: Houlong Wei <houlong.wei@mediatek.com>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

      reply	other threads:[~2019-07-12  7:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-09 17:24 [PATCH] media: platform: mtk-mdp: mtk_mdp_core: Add of_node_put() before goto Nishka Dasgupta
2019-07-12  7:37 ` 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=1562917032.29653.7.camel@mhfsdcap03 \
    --to=houlong.wei@mediatek.com \
    --cc=Andrew-CT.Chen@mediatek.com \
    --cc=Minghsiu.Tsai@mediatek.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=mchehab@kernel.org \
    --cc=nishkadg.linux@gmail.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).