public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm: Set dev->registered back to false in case of register failure
Date: Mon, 25 May 2026 18:27:45 +1000	[thread overview]
Message-ID: <review-patch1-20260522154037.46892-3-krzysztof.niemiec@intel.com> (raw)
In-Reply-To: <20260522154037.46892-3-krzysztof.niemiec@intel.com>

Patch Review

**Correctness: Good.** The patch places `dev->registered = false` at the `err_minors` label, which is reached by both error paths (`err_unload` falls through to `err_minors`). This means the flag is cleared regardless of whether the failure came from `driver->load()` or `drm_modeset_register_all()`.

Critically, `err_minors` is also the target for failures *before* `dev->registered = true` is set (lines 1075–1089), so setting it to `false` there is a no-op in those cases (it was already `false`). This is harmless and correct.

**Placement within `err_minors`:** The patch places `dev->registered = false` at the top of `err_minors`, before `remove_compat_control_link()`:

```c
err_minors:
+	dev->registered = false;
	remove_compat_control_link(dev);
```

This mirrors `drm_dev_unregister()` which sets `dev->registered = false` as its first action (line 1148). The placement is consistent and correct — clearing the flag first ensures that any code triggered during teardown (e.g., `drm_minor_unregister` → eventual mode object cleanup) sees the device as unregistered.

**Commit message quality:** The commit message is well-written. It explains the history of how the bug was introduced (the later addition of `drm_modeset_register_all()` error checking), describes the concrete symptom (spurious `WARN_ON` in `drm_mode_object_register()`), and is clear about the fix.

**One minor note on the commit message:** The message says the WARN_ON is in `drm_mode_object_register()`, but looking at the current tree, `drm_mode_object_register()` doesn't contain a WARN_ON — it's a simple `idr_replace()` under a mutex. The WARN_ON the author is likely referring to may be elsewhere (possibly in `drm_mode_object_unregister()` or in connector/framebuffer registration paths that check `dev->registered`). This doesn't affect the correctness of the fix, but the commit message could be slightly more precise about which WARN_ON is triggered.

**Missing cleanup consideration:** Looking at the `err_unload` path: when `drm_modeset_register_all()` fails, the error path calls `driver->unload()` and then falls through to `err_minors`. However, `drm_modeset_register_all()` success would be followed by `drm_panic_register()` and `drm_client_sysrq_register()` on the happy path. In the `err_unload` path, `drm_modeset_unregister_all()` is *not* called to undo the partial modeset registration — this is a pre-existing issue and out of scope for this patch, but worth noting.

**Verdict: The patch is correct and should be applied.** It's a clear, minimal fix for a real inconsistency in the error handling.

---
Generated by Claude Code Patch Reviewer

      parent reply	other threads:[~2026-05-25  8:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-22 15:40 [PATCH] drm: Set dev->registered back to false in case of register failure Krzysztof Niemiec
2026-05-25  8:16 ` Janusz Krzysztofik
2026-05-25  8:27 ` Claude review: " Claude Code Review Bot
2026-05-25  8:27 ` Claude Code Review Bot [this message]

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-20260522154037.46892-3-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