[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1dfd0643-bec6-5360-bbd1-968848b760f9@xs4all.nl>
Date: Wed, 19 Jul 2023 09:41:52 +0200
From: Hans Verkuil <hverkuil-cisco@...all.nl>
To: Lu Hongfei <luhongfei@...o.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>,
Moudy Ho <moudy.ho@...iatek.com>,
Ping-Hsun Wu <ping-hsun.wu@...iatek.com>,
Arnd Bergmann <arnd@...db.de>, Sun Ke <sunke32@...wei.com>,
"open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)"
<linux-media@...r.kernel.org>,
"open list:ARM/Mediatek SoC support" <linux-kernel@...r.kernel.org>,
"moderated list:ARM/Mediatek SoC support"
<linux-arm-kernel@...ts.infradead.org>,
"moderated list:ARM/Mediatek SoC support"
<linux-mediatek@...ts.infradead.org>
Cc: opensource.kernel@...o.com
Subject: Re: [PATCH] media: Fix resource leaks in for_each_child_of_node()
loops
Hi Lu Hongfei,
Please add the driver name to the subject line: 'media: mdp3:'!
On 30/05/2023 11:45, Lu Hongfei wrote:
> for_each_child_of_node should have of_node_put() avoid resource leaks.
>
> Signed-off-by: Lu Hongfei <luhongfei@...o.com>
> ---
> drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c | 3 +++
> 1 file changed, 3 insertions(+)
> mode change 100644 => 100755 drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c
>
> diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c
> index 19a4a085f73a..5a6a61d68cba
> --- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c
> +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c
> @@ -1128,6 +1128,7 @@ int mdp_comp_config(struct mdp_dev *mdp)
> comp = mdp_comp_create(mdp, node, id);
> if (IS_ERR(comp)) {
> ret = PTR_ERR(comp);
> + of_node_put(node);
This is needed,
> goto err_init_comps;
> }
>
> @@ -1137,6 +1138,8 @@ int mdp_comp_config(struct mdp_dev *mdp)
> pm_runtime_enable(comp->comp_dev);
> }
>
> + of_node_put(node);
> +
but not this one. The for_each_child_of_node loop ended, so node == NULL and
there is nothing to put.
Regards,
Hans
> ret = mdp_comp_sub_create(mdp);
> if (ret)
> goto err_init_comps;
Powered by blists - more mailing lists