Skip to content

Commit 620a8f1

Browse files
jhovoldrgallaispouSTM
authored andcommitted
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: cc6b741 ("drm: sti: remove useless fields from vtg structure") Cc: stable@vger.kernel.org # 4.16 Cc: Benjamin Gaignard <benjamin.gaignard@collabora.com> Signed-off-by: Johan Hovold <johan@kernel.org> Link: https://patch.msgid.link/20250922122012.27407-1-johan@kernel.org Signed-off-by: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com>
1 parent 83c53f1 commit 620a8f1

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

drivers/gpu/drm/sti/sti_vtg.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,17 @@ struct sti_vtg {
143143
struct sti_vtg *of_vtg_find(struct device_node *np)
144144
{
145145
struct platform_device *pdev;
146+
struct sti_vtg *vtg;
146147

147148
pdev = of_find_device_by_node(np);
148149
if (!pdev)
149150
return NULL;
150151

151-
return (struct sti_vtg *)platform_get_drvdata(pdev);
152+
vtg = platform_get_drvdata(pdev);
153+
154+
put_device(&pdev->dev);
155+
156+
return vtg;
152157
}
153158

154159
static void vtg_reset(struct sti_vtg *vtg)

0 commit comments

Comments
 (0)