public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/sti: hdmi: Fix bridge leak on component_add() failure
@ 2026-04-24 12:23 Myeonghun Pak
  0 siblings, 0 replies; only message in thread
From: Myeonghun Pak @ 2026-04-24 12:23 UTC (permalink / raw)
  To: Alain Volmat, Raphael Gallais-Pou
  Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, dri-devel, linux-kernel, Myeonghun Pak

sti_hdmi_probe() registers its bridge before adding the component. If
component_add() fails, probe returns the error and leaves the bridge
registered.

The remove callback unregisters the bridge, but remove is only called
after a successful probe. Remove the bridge locally when component_add()
fails, then continue through the existing adapter unwind path.

Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
---
 drivers/gpu/drm/sti/sti_hdmi.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
index f8222e60b1..d7b61b5b35 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.c
+++ b/drivers/gpu/drm/sti/sti_hdmi.c
@@ -1460,9 +1460,15 @@ static int sti_hdmi_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, hdmi);
 
 	drm_bridge_add(&hdmi->bridge);
-	return component_add(&pdev->dev, &sti_hdmi_ops);
+	ret = component_add(&pdev->dev, &sti_hdmi_ops);
+	if (ret)
+		goto bridge_remove;
 
- release_adapter:
+	return 0;
+
+bridge_remove:
+	drm_bridge_remove(&hdmi->bridge);
+release_adapter:
 	i2c_put_adapter(hdmi->ddc_adapt);
 
 	return ret;
-- 
2.50.1

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-04-24 12:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-24 12:23 [PATCH] drm/sti: hdmi: Fix bridge leak on component_add() failure Myeonghun Pak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox