[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <48a07b61-edb6-1c2f-8299-14d346ab7b2e@xs4all.nl>
Date: Fri, 21 Jul 2023 11:41:44 +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>,
daoyuan huang <daoyuan.huang@...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 v3] media: platform: mtk-mdp3: Fix resource leak in
mdp_get_subsys_id() and mdp_comp_config()
Hi Lu Hongfei,
On 13/06/2023 05:27, Lu Hongfei wrote:
> Add a put_device() call for the release of the object
> which was determined by a of_find_device_by_node() call
> in mdp_get_subsys_id().
>
> Add of_node_put() call for the release of the object
> which was determined by a for_each_child_of_node() call
> in mdp_comp_config().
After merging this patch from you into our media_stage tree:
https://patchwork.linuxtv.org/project/linux-media/patch/20230530101724.31412-1-luhongfei@vivo.com/
this v3 no longer applies. So I will need a v4, I'm afraid...
Regards,
Hans
>
> Signed-off-by: Lu Hongfei <luhongfei@...o.com>
> ---
> The previous version’s Subject was:
> [PATCH v2] media: platform: mtk-mdp3: Fix resource leaks in mdp_get_subsys_id()
>
> The modifications made compared to the previous version are as follows:
> 1. Modified the patch subject
> 2. Fix resource leak issue in mdp_comp_config()
>
> drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c
> index a605e80c7dc3..85c5f89f2ed2
> --- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c
> +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c
> @@ -892,13 +892,16 @@ static int mdp_get_subsys_id(struct mdp_dev *mdp, struct device *dev,
> ret = cmdq_dev_get_client_reg(&comp_pdev->dev, &cmdq_reg, index);
> if (ret != 0) {
> dev_err(&comp_pdev->dev, "cmdq_dev_get_subsys fail!\n");
> - return -EINVAL;
> + ret = -EINVAL;
> + goto put_device;
> }
>
> comp->subsys_id = cmdq_reg.subsys;
> dev_dbg(&comp_pdev->dev, "subsys id=%d\n", cmdq_reg.subsys);
>
> - return 0;
> +put_device:
> + put_device(&comp_pdev->dev);
> + return ret;
> }
>
> static void __mdp_comp_init(struct mdp_dev *mdp, struct device_node *node,
> @@ -1135,6 +1138,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);
> goto err_init_comps;
> }
>
> @@ -1144,6 +1148,8 @@ int mdp_comp_config(struct mdp_dev *mdp)
> pm_runtime_enable(comp->comp_dev);
> }
>
> + of_node_put(node);
> +
> ret = mdp_comp_sub_create(mdp);
> if (ret)
> goto err_init_comps;
Powered by blists - more mailing lists