[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250922122012.27407-1-johan@kernel.org>
Date: Mon, 22 Sep 2025 14:20:12 +0200
From: Johan Hovold <johan@...nel.org>
To: Alain Volmat <alain.volmat@...s.st.com>,
Raphael Gallais-Pou <rgallaispou@...il.com>
Cc: Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...il.com>,
Simona Vetter <simona@...ll.ch>,
dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org,
Johan Hovold <johan@...nel.org>,
stable@...r.kernel.org,
Benjamin Gaignard <benjamin.gaignard@...labora.com>
Subject: [PATCH] drm: sti: fix device leaks at component probe
Make sure to drop the references taken to the vtg devices by
of_find_device_by_node() when looking up their driver data during
component probe.
Note that holding a reference to a platform device does not prevent its
driver data from going away so there is no point in keeping the
reference after the lookup helper returns.
Fixes: cc6b741c6f63 ("drm: sti: remove useless fields from vtg structure")
Cc: stable@...r.kernel.org # 4.16
Cc: Benjamin Gaignard <benjamin.gaignard@...labora.com>
Signed-off-by: Johan Hovold <johan@...nel.org>
---
drivers/gpu/drm/sti/sti_vtg.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/sti/sti_vtg.c b/drivers/gpu/drm/sti/sti_vtg.c
index ee81691b3203..ce6bc7e7b135 100644
--- a/drivers/gpu/drm/sti/sti_vtg.c
+++ b/drivers/gpu/drm/sti/sti_vtg.c
@@ -143,12 +143,17 @@ struct sti_vtg {
struct sti_vtg *of_vtg_find(struct device_node *np)
{
struct platform_device *pdev;
+ struct sti_vtg *vtg;
pdev = of_find_device_by_node(np);
if (!pdev)
return NULL;
- return (struct sti_vtg *)platform_get_drvdata(pdev);
+ vtg = platform_get_drvdata(pdev);
+
+ put_device(&pdev->dev);
+
+ return vtg;
}
static void vtg_reset(struct sti_vtg *vtg)
--
2.49.1
Powered by blists - more mailing lists