mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/kmb: fix bridge reference leak on probe error and remove
@ 2026-10-09  3:35 Haotian Zhang
  2026-10-09  6:10 ` Krzysztof Kozlowski
  0 siblings, 1 reply; 2+ messages in thread
From: Haotian Zhang @ 2026-10-09  3:35 UTC (permalink / raw)
  To: Anitha Chrisanthus, David Airlie, Simona Vetter, Linus Walleij,
	Luca Ceresoli, Louis Chauvet
  Cc: dri-devel, linux-kernel

kmb_dsi_host_bridge_init() looks up the ADV7535 bridge with
of_drm_find_and_get_bridge(), which takes a reference on the bridge, and
stores it in the global adv_bridge. That reference is never released, so
unbinding the driver leaves the bridge refcount permanently elevated and
prevents the bridge driver from ever being removed. The same happens
when probe fails after the bridge has been found.

Release the reference in kmb_dsi_host_unregister(), which is called both
from the probe error path and from kmb_remove().

Fixes: abbe7f8144d5 ("drm/kmb/dsi: convert to of_drm_find_and_get_bridge()")
Assisted-by: DeepSeek-V4.1-Flash
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
---
 drivers/gpu/drm/kmb/kmb_dsi.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/kmb/kmb_dsi.c b/drivers/gpu/drm/kmb/kmb_dsi.c
index 59d0e856392f..483f4afe6317 100644
--- a/drivers/gpu/drm/kmb/kmb_dsi.c
+++ b/drivers/gpu/drm/kmb/kmb_dsi.c
@@ -184,6 +184,10 @@ void kmb_dsi_host_unregister(struct kmb_dsi *kmb_dsi)
 {
 	kmb_dsi_clk_disable(kmb_dsi);
 	mipi_dsi_host_unregister(kmb_dsi->host);
+
+	/* Release the bridge reference taken in kmb_dsi_host_bridge_init() */
+	drm_bridge_put(adv_bridge);
+	adv_bridge = NULL;
 }
 
 /*
-- 
2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-09  6:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-09  3:35 [PATCH] drm/kmb: fix bridge reference leak on probe error and remove Haotian Zhang
2026-10-09  6:10 ` Krzysztof Kozlowski

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®