* [PATCH] drm/omapdrm: avoid double drm_mode_config_cleanup()
@ 2026-05-13 12:00 Hongyan Xu
2026-05-16 2:06 ` Claude review: " Claude Code Review Bot
2026-05-16 2:06 ` Claude Code Review Bot
0 siblings, 2 replies; 3+ messages 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] 3+ messages in thread
* Claude review: drm/omapdrm: avoid double drm_mode_config_cleanup()
2026-05-13 12:00 [PATCH] drm/omapdrm: avoid double drm_mode_config_cleanup() Hongyan Xu
@ 2026-05-16 2:06 ` Claude Code Review Bot
2026-05-16 2:06 ` Claude Code Review Bot
1 sibling, 0 replies; 3+ messages in thread
From: Claude Code Review Bot @ 2026-05-16 2:06 UTC (permalink / raw)
To: dri-devel-reviews
Overall Series Review
Subject: drm/omapdrm: avoid double drm_mode_config_cleanup()
Author: Hongyan Xu <getshell@seu.edu.cn>
Patches: 1
Reviewed: 2026-05-16T12:06:25.913209
---
This is a single-patch series that fixes a real double-cleanup bug in the omapdrm driver. The analysis in the commit message is correct: `drm_mode_config_cleanup()` is called twice in both error and normal teardown paths. The fix is minimal, correct, and well-targeted. **Recommend: Accept with minor commit message nits.**
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 3+ messages in thread
* Claude review: drm/omapdrm: avoid double drm_mode_config_cleanup()
2026-05-13 12:00 [PATCH] drm/omapdrm: avoid double drm_mode_config_cleanup() Hongyan Xu
2026-05-16 2:06 ` Claude review: " Claude Code Review Bot
@ 2026-05-16 2:06 ` Claude Code Review Bot
1 sibling, 0 replies; 3+ messages in thread
From: Claude Code Review Bot @ 2026-05-16 2:06 UTC (permalink / raw)
To: dri-devel-reviews
Patch Review
**Verdict: The bug is real and the fix is correct.**
The code structure is:
- `drm_mode_config_init()` is called in `omapdrm_init()` at line 715
- `drm_mode_config_cleanup()` is called in the `err_gem_deinit` label (line 761) and in `omapdrm_cleanup()` (line 785)
- `omap_modeset_init()` calls `omap_drm_irq_install()` — it does NOT call `drm_mode_config_init()`
So the init/cleanup pairing should be:
- `omap_modeset_init()` ↔ `omap_modeset_fini()` — IRQ install/uninstall only
- `drm_mode_config_init()` ↔ `drm_mode_config_cleanup()` — handled at the `omapdrm_init()`/`omapdrm_cleanup()` level
**Error path double-cleanup (confirmed):** When `drm_vblank_init()` or `drm_dev_register()` fail, the error path hits `err_cleanup_modeset` → `omap_modeset_fini()` (which before this patch called `drm_mode_config_cleanup()`), then falls through to `err_gem_deinit` → `drm_mode_config_cleanup()` again.
**Normal teardown double-cleanup (confirmed):** `omapdrm_cleanup()` calls `omap_modeset_fini()` at line 782 (which before the patch called `drm_mode_config_cleanup()`), then calls `drm_mode_config_cleanup()` again at line 785.
After this patch, `omap_modeset_fini()` only calls `omap_drm_irq_uninstall()`, which correctly mirrors `omap_modeset_init()` calling `omap_drm_irq_install()`. The `drm_mode_config_cleanup()` is left solely in the top-level paths where it belongs.
**Minor nits:**
1. The commit message line `Issue found using a prototype static analysis tool` lacks a `Signed-off-by`-style trailer separator — it reads as part of the body but feels like a tagline. Convention is to either drop it or phrase it as part of the description.
2. The `Signed-off-by` from Slavin Liu (`220245772@seu.edu.cn`) — this person is listed as `Cc:` in the mail headers. If they co-developed the patch, a `Co-developed-by:` tag should precede their `Signed-off-by:` per kernel conventions (`Documentation/process/submitting-patches.rst`). If they only reviewed, `Reviewed-by:` would be more appropriate.
3. After the patch, `omap_modeset_fini()` becomes a trivial one-line wrapper around `omap_drm_irq_uninstall()`. This is fine — keeping the `_init`/`_fini` symmetry aids readability — but a reviewer could reasonably suggest inlining it. Not a blocker.
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-05-16 2:06 UTC | newest]
Thread overview: 3+ messages (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
2026-05-16 2:06 ` Claude review: " Claude Code Review Bot
2026-05-16 2:06 ` Claude Code Review Bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox