The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] drm/omapdrm: avoid double drm_mode_config_cleanup()
@ 2026-05-13 12:00 Hongyan Xu
  0 siblings, 0 replies; only message in thread
From: Hongyan Xu @ 2026-05-13 12:00 UTC (permalink / raw)
  To: tomi.valkeinen; +Cc: dri-devel, linux-kernel, getshell, jianhao.xu, Slavin Liu

omapdrm_init() unwinds drm_vblank_init() and drm_dev_register()
failures through omap_modeset_fini() and then falls through to
err_gem_deinit, which calls drm_mode_config_cleanup() again.

omapdrm_cleanup() has the same problem during the normal teardown path:
it calls omap_modeset_fini() and then calls drm_mode_config_cleanup()
again afterwards.

omap_modeset_fini() should only undo omap_modeset_init(). The
drm_mode_config_init()/drm_mode_config_cleanup() pairing already lives
in the top-level init and cleanup paths, so keeping another
drm_mode_config_cleanup() inside omap_modeset_fini() causes repeated
cleanup of the same mode_config state.

Remove drm_mode_config_cleanup() from omap_modeset_fini() so each path
cleans mode_config exactly once.

Fixes: 2f95bc6d324a ("drm: omapdrm: Perform initialization/cleanup at probe/remove time")
Issue found using a prototype static analysis tool
and confirmed by code review.

Signed-off-by: Hongyan Xu <getshell@seu.edu.cn>
Signed-off-by: Slavin Liu <220245772@seu.edu.cn>
---
 drivers/gpu/drm/omapdrm/omap_drv.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index bf0bad8c8cf1..838a1a236160 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -538,8 +538,6 @@ static int omap_modeset_init(struct drm_device *dev)
 static void omap_modeset_fini(struct drm_device *ddev)
 {
 	omap_drm_irq_uninstall(ddev);
-
-	drm_mode_config_cleanup(ddev);
 }
 
 /*
-- 
2.50.1.windows.1


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

only message in thread, other threads:[~2026-05-13 12:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-13 12:00 [PATCH] drm/omapdrm: avoid double drm_mode_config_cleanup() Hongyan Xu

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