public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/tve200: Fix probe cleanup after register failure
@ 2026-04-24 12:40 Myeonghun Pak
  2026-05-05  9:18 ` Linus Walleij
  0 siblings, 1 reply; 2+ messages in thread
From: Myeonghun Pak @ 2026-04-24 12:40 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Myeonghun Pak, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, dri-devel,
	linux-kernel

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.

Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
---
 drivers/gpu/drm/tve200/tve200_drv.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tve200/tve200_drv.c b/drivers/gpu/drm/tve200/tve200_drv.c
index a048e37f1c..562f3f1181 100644
--- a/drivers/gpu/drm/tve200/tve200_drv.c
+++ b/drivers/gpu/drm/tve200/tve200_drv.c
@@ -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:
-- 
2.50.1

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

* Re: [PATCH] drm/tve200: Fix probe cleanup after register failure
  2026-04-24 12:40 [PATCH] drm/tve200: Fix probe cleanup after register failure Myeonghun Pak
@ 2026-05-05  9:18 ` Linus Walleij
  0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2026-05-05  9:18 UTC (permalink / raw)
  To: Myeonghun Pak
  Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, dri-devel, linux-kernel

On Fri, Apr 24, 2026 at 2:41 PM Myeonghun Pak <mhun512@gmail.com> wrote:

> 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.
>
> Signed-off-by: Myeonghun Pak <mhun512@gmail.com>

Patch applied to drm-misc-next.

Yours,
Linus Walleij

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

end of thread, other threads:[~2026-05-05  9:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-24 12:40 [PATCH] drm/tve200: Fix probe cleanup after register failure Myeonghun Pak
2026-05-05  9:18 ` Linus Walleij

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