The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Hongyan Xu <getshell@seu.edu.cn>
To: tomi.valkeinen@ideasonboard.com
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	getshell@seu.edu.cn, jianhao.xu@seu.edu.cn,
	Slavin Liu <220245772@seu.edu.cn>
Subject: [PATCH] drm/omapdrm: avoid double drm_mode_config_cleanup()
Date: Wed, 13 May 2026 20:00:34 +0800	[thread overview]
Message-ID: <20260513120034.182-1-getshell@seu.edu.cn> (raw)

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


                 reply	other threads:[~2026-05-13 12:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260513120034.182-1-getshell@seu.edu.cn \
    --to=getshell@seu.edu.cn \
    --cc=220245772@seu.edu.cn \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jianhao.xu@seu.edu.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tomi.valkeinen@ideasonboard.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox