Skip to contentSkip to conversation

drm/tve200: Fix probe cleanup after register failure

PATCH In review Myeonghun Pak 2 participants 3 messages Apr 24 – May 6

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/tve200: Fix probe cleanup after register failure

tve200_modeset_init() creates a panel bridge and initializes the DRM mode config before tve200_probe() registers the DRM device. If drm_dev_register() fails, probe returns an error and the driver's remove callback is not called, so those modeset resources are left behind.

Unwind the panel bridge and mode config on that failure path before disabling the clock and dropping the DRM device reference.

---
 drivers/gpu/drm/tve200/tve200_drv.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/tve200/tve200_drv.c +5 -1
index a048e37f1c..562f3f1181 100644
@@ -221,12 +221,16 @@ static int tve200_probe(struct platform_device *pdev)
 
 	ret = drm_dev_register(drm, 0);
 	if (ret < 0)
-		goto clk_disable;
+		goto mode_config_cleanup;
 
 	drm_client_setup_with_fourcc(drm, DRM_FORMAT_RGB565);
 
 	return 0;
 
+mode_config_cleanup:
+	if (priv->panel)
+		drm_panel_bridge_remove(priv->bridge);
+	drm_mode_config_cleanup(drm);
 clk_disable:
 	clk_disable_unprepare(priv->pclk);
 dev_unref:
Signature · 1 line
2.50.1
maintainer
#1 lore raw
Quoted 9 lines · Myeonghun Pak

tve200_modeset_init() creates a panel bridge and initializes the DRM mode config before tve200_probe() registers the DRM device. If drm_dev_register() fails, probe returns an error and the driver's remove callback is not called, so those modeset resources are left behind.

Unwind the panel bridge and mode config on that failure path before disabling the clock and dropping the DRM device reference.

Patch applied to drm-misc-next.

Yours,
Linus Walleij

#2 lore raw

Dear Linus,

Thank you for applying the patch to drm-misc-next.

Best regards,
Myeonghun Pak

2026년 5월 5일 (화) 오후 6:18, Linus Walleij <[email protected]>님이 작성:

Quoted 17 lines · Myeonghun Pak
Quoted 10 lines

tve200_modeset_init() creates a panel bridge and initializes the DRM mode config before tve200_probe() registers the DRM device. If drm_dev_register() fails, probe returns an error and the driver's remove callback is not called, so those modeset resources are left behind.

Unwind the panel bridge and mode config on that failure path before disabling the clock and dropping the DRM device reference.

Patch applied to drm-misc-next.

Yours,
Linus Walleij