[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20230613025515.24512-1-luhongfei@vivo.com>
Date: Tue, 13 Jun 2023 10:55:06 +0800
From: Lu Hongfei <luhongfei@...o.com>
To: Mauro Carvalho Chehab <mchehab@...nel.org>,
Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>,
Hans Verkuil <hverkuil-cisco@...all.nl>,
Moudy Ho <moudy.ho@...iatek.com>,
Deepak R Varma <drv@...lo.com>,
Arnd Bergmann <arnd@...db.de>, Sun Ke <sunke32@...wei.com>,
Lu Hongfei <luhongfei@...o.com>,
linux-media@...r.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE
(V4L/DVB)),
linux-kernel@...r.kernel.org (open list:ARM/Mediatek SoC support),
linux-arm-kernel@...ts.infradead.org (moderated list:ARM/Mediatek SoC
support),
linux-mediatek@...ts.infradead.org (moderated list:ARM/Mediatek SoC
support)
Cc: opensource.kernel@...o.com
Subject: [PATCH v2] media: platform: mtk-mdp3: Fix resource leaks in mdp_get_subsys_id()
Add a put_device() call for the release of the object
which was determined by a of_find_device_by_node() call.
Signed-off-by: Lu Hongfei <luhongfei@...o.com>
---
The modifications made compared to the previous version are as follows:
1. Modified the patch subject
2. Modified the commit message to make it easier to understand.
3. Use an additional label "put_device". Increase the usage of the variable "ret".
drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c | 7 +++++--
1 file changed, 5 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..ec39662a2282
--- 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,
--
2.39.0
Powered by blists - more mailing lists