Skip to content

Commit 4b746bb

Browse files
jhovoldUlrich Hecht
authored andcommitted
drm: sti: fix device leaks at component probe
commit 620a8f131154250f6a64a07d049a4f235d6451a5 upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Ulrich Hecht <uli@kernel.org>
1 parent 9bacd9f commit 4b746bb

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
@@ -141,12 +141,17 @@ struct sti_vtg {
141141
struct sti_vtg *of_vtg_find(struct device_node *np)
142142
{
143143
struct platform_device *pdev;
144+
struct sti_vtg *vtg;
144145

145146
pdev = of_find_device_by_node(np);
146147
if (!pdev)
147148
return NULL;
148149

149-
return (struct sti_vtg *)platform_get_drvdata(pdev);
150+
vtg = platform_get_drvdata(pdev);
151+
152+
put_device(&pdev->dev);
153+
154+
return vtg;
150155
}
151156

152157
static void vtg_reset(struct sti_vtg *vtg)

0 commit comments

Comments
 (0)