From: CK Hu <ck.hu@mediatek.com>
To: Nishka Dasgupta <nishkadg.linux@gmail.com>
Cc: p.zabel@pengutronix.de, airlie@linux.ie,
dri-devel@lists.freedesktop.org,
linux-mediatek@lists.infradead.org, daniel@ffwll.ch,
matthias.bgg@gmail.com, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] gpu: drm: mediatek: mtk_drm_drv.c: Add of_node_put() before goto
Date: Mon, 19 Aug 2019 09:30:31 +0800 [thread overview]
Message-ID: <1566178231.7536.1.camel@mtksdaap41> (raw)
In-Reply-To: <20190706133021.3308-1-nishkadg.linux@gmail.com>
Hi, Nishka:
On Sat, 2019-07-06 at 19:00 +0530, 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.
Applied to mediatek-drm-fixes-5.3 [1], thanks.
[1]
https://github.com/ckhu-mediatek/linux.git-tags/tree/mediatek-drm-fixes-5.3
Regards,
CK
>
> Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
> ---
> drivers/gpu/drm/mediatek/mtk_drm_drv.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> index 95fdbd0fbcac..2dffbc8c6d73 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> @@ -524,12 +524,15 @@ static int mtk_drm_probe(struct platform_device *pdev)
> comp = devm_kzalloc(dev, sizeof(*comp), GFP_KERNEL);
> if (!comp) {
> ret = -ENOMEM;
> + of_node_put(node);
> goto err_node;
> }
>
> ret = mtk_ddp_comp_init(dev, node, comp, comp_id, NULL);
> - if (ret)
> + if (ret) {
> + of_node_put(node);
> goto err_node;
> + }
>
> private->ddp_comp[comp_id] = comp;
> }
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2019-08-19 1:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-06 13:30 [PATCH] gpu: drm: mediatek: mtk_drm_drv.c: Add of_node_put() before goto Nishka Dasgupta
2019-08-19 1:30 ` CK Hu [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=1566178231.7536.1.camel@mtksdaap41 \
--to=ck.hu@mediatek.com \
--cc=airlie@linux.ie \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=nishkadg.linux@gmail.com \
--cc=p.zabel@pengutronix.de \
/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