From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/i915: Remove drm_dev_unregister() from the error path during i915_driver_register()
Date: Mon, 25 May 2026 18:26:20 +1000 [thread overview]
Message-ID: <review-patch1-20260522154356.47588-2-krzysztof.niemiec@intel.com> (raw)
In-Reply-To: <20260522154356.47588-2-krzysztof.niemiec@intel.com>
Patch Review
**Verdict: Looks good.**
The commit message accurately describes the problem and the fix. I verified each claim:
1. **`drm_dev_register()` cleans up after itself on failure.** Confirmed in `drm_drv.c:1115-1123` — on error, `drm_dev_register()` jumps to `err_minors` which calls `remove_compat_control_link()`, `drm_minor_unregister()` for all three minor types, then returns the error. So calling `drm_dev_unregister()` after a failed `drm_dev_register()` is indeed double-cleanup.
2. **`drm_client_sysrq_register()` is only called on success.** Confirmed at `drm_drv.c:1105` — `drm_client_sysrq_register(dev)` is called just before the success return, after both `err_unload` and `err_minors` labels. If `drm_dev_register()` fails, this call never executes.
3. **`drm_client_sysrq_unregister()` triggers a WARN_ON.** Confirmed at `drm_client_sysrq.c:58` — `drm_client_sysrq_unregister()` does `drm_WARN_ON(dev, list_empty(&dev->client_sysrq_list))`. Since `drm_client_sysrq_register()` was never called, the list head is in its initialized (empty) state, triggering the warning.
4. **The remaining error path is correct.** After removing the `drm_dev_unregister()` call, the error path at `i915_driver.c:639-645` still correctly unwinds `i915_pmu_register()` and `i915_gem_driver_register()` which were called earlier in the function at lines 632-633. The `intel_vgpu_register()` at line 635 does not appear to have an unregister counterpart needed in this path (it's a no-op on non-VF), so the cleanup sequence is correct.
5. **Additionally, `drm_dev_unregister()` does more than just undo `drm_dev_register()`** — it also calls `drm_client_dev_unregister()`, `drm_modeset_unregister_all()`, and `drm_debugfs_dev_fini()` (`drm_drv.c:1146-1166`). Calling these when their corresponding register functions were never called (because `drm_dev_register()` failed) is wrong and could cause further issues beyond the WARN_ON.
No concerns with this patch.
Reviewed-by is warranted.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-05-25 8:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-22 15:43 [PATCH] drm/i915: Remove drm_dev_unregister() from the error path during i915_driver_register() Krzysztof Niemiec
2026-05-25 7:38 ` Sebastian Brzezinka
2026-05-25 8:11 ` Janusz Krzysztofik
2026-05-25 8:26 ` Claude Code Review Bot [this message]
2026-05-25 8:26 ` Claude review: " Claude Code Review Bot
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=review-patch1-20260522154356.47588-2-krzysztof.niemiec@intel.com \
--to=claude-review@example.com \
--cc=dri-devel-reviews@example.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