mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/sti: dvo: Remove bridge on attach failure
@ 2026-07-28 16:55 Myeonghun Pak
  0 siblings, 0 replies; only message in thread
From: Myeonghun Pak @ 2026-07-28 16:55 UTC (permalink / raw)
  To: Alain Volmat, Raphael Gallais-Pou
  Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Simona Vetter, Thierry Reding, dri-devel,
	linux-kernel, stable, Myeonghun Pak, Ijae Kim

drm_bridge_add() registers the bridge globally and takes a reference.
If the subsequent drm_bridge_attach() call fails, the component bind
callback returns without being considered bound, so its unbind callback is
not called. This leaves the bridge registered and its reference held.

Remove the bridge before returning the attach error.

Fixes: 384764c36116 ("drm/sti: fixup for bridge interface")
Cc: stable@vger.kernel.org
Co-developed-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
---
 drivers/gpu/drm/sti/sti_dvo.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c
index 7484d3c3f4..4978e0acbf 100644
--- a/drivers/gpu/drm/sti/sti_dvo.c
+++ b/drivers/gpu/drm/sti/sti_dvo.c
@@ -459,8 +459,10 @@ static int sti_dvo_bind(struct device *dev, struct device *master, void *data)
 	drm_bridge_add(&dvo->bridge);
 
 	err = drm_bridge_attach(encoder, &dvo->bridge, NULL, 0);
-	if (err)
+	if (err) {
+		drm_bridge_remove(&dvo->bridge);
 		return err;
+	}
 
 	connector->encoder = encoder;
 	dvo->encoder = encoder;
-- 
2.47.1

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

only message in thread, other threads:[~2026-07-28 16:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-28 16:55 [PATCH] drm/sti: dvo: Remove bridge on attach 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

all inboxes | Powered by JetHome®