[PATCH] drm/rockchip: rgb: fix panel bridge reference leak on setup error

Wentao Liang vulab at iscas.ac.cn
Tue Nov 3 18:40:58 PST 2026


rockchip_rgb_init() wraps the panel with drm_panel_bridge_add_typed(),
which returns a counted reference on the panel's bridge. When
drm_bridge_attach() or drm_bridge_connector_init() fails afterwards,
the error path only cleans up the encoder, leaving that reference
behind and leaking the bridge.

Release the bridge in the error path, just like rockchip_rgb_fini()
does on the success path.

Fixes: b7797081ccfe ("drm/panel: embed a drm_bridge into every drm_panel")
Cc: stable at vger.kernel.org
Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
Signed-off-by: Wentao Liang <vulab at iscas.ac.cn>
---
 drivers/gpu/drm/rockchip/rockchip_rgb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/rockchip/rockchip_rgb.c b/drivers/gpu/drm/rockchip/rockchip_rgb.c
index 0e1830bc40ee..10219638c0a2 100644
--- a/drivers/gpu/drm/rockchip/rockchip_rgb.c
+++ b/drivers/gpu/drm/rockchip/rockchip_rgb.c
@@ -172,6 +172,7 @@ struct rockchip_rgb *rockchip_rgb_init(struct device *dev,
 	return rgb;
 
 err_free_encoder:
+	drm_panel_bridge_remove(rgb->bridge);
 	drm_encoder_cleanup(encoder);
 	return ERR_PTR(ret);
 }
-- 
2.34.1




More information about the Linux-rockchip mailing list