From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/i915/gt: Use IS_ERR() check for kernel_context() in selftests
Date: Sat, 16 May 2026 10:29:02 +1000 [thread overview]
Message-ID: <review-patch1-20260514193227.2472962-1-ingyujang25@korea.ac.kr> (raw)
In-Reply-To: <20260514193227.2472962-1-ingyujang25@korea.ac.kr>
Patch Review
**Correctness of the core fix: Good.** The commit message accurately describes the problem: `kernel_context()` returns an error pointer on failure, so `!ctx` checks are dead code that won't catch allocation failures. The fix is the right pattern.
**Four call sites fixed correctly:**
1. **`live_preempt()`** (line 1744): `ctx_hi` — straightforward early return, correct.
2. **`live_preempt()`** (line 1749): `ctx_lo` — correctly captures `PTR_ERR(ctx_lo)` into `err` before `goto err_ctx_hi`, since the previous code was relying on the `err = -ENOMEM` initializer which would have been wrong for a different error code.
3. **`live_late_preempt()`** (lines 1838, 1842): Same pattern, correct.
4. **`preempt_client_init()`** (line 1940): Direct return of `PTR_ERR`, correct.
5. **`live_preempt_timeout()`** (lines 3390, 3395): Same pattern as `live_preempt`, correct.
**Issue: Missed call site in the same file.**
At `selftest_execlists.c:3685`:
```c
smoke.contexts[n] = kernel_context(smoke.gt->i915, NULL);
if (!smoke.contexts[n])
goto err_ctx;
```
This has the identical bug but was not fixed. The `err_ctx` cleanup path iterates `smoke.contexts[]` and calls `kernel_context_close()` on each, so storing an `ERR_PTR` there would also cause a crash during cleanup. The fix here requires both converting the check to `IS_ERR()` and clearing the pointer (or otherwise guarding the cleanup loop). Since the commit message claims to fix this pattern in the file, this omission should be addressed.
**Minor style note:** The added braces around single-statement `goto` blocks (e.g., `if (IS_ERR(ctx_lo)) { err = PTR_ERR(ctx_lo); goto err_ctx_hi; }`) are correct since these are now multi-statement blocks (assignment + goto).
**Recommendation:** Request a v2 that also fixes the `live_preempt_smoke()` site at line 3685, and ideally audits other selftest files for the same pattern.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-05-16 0:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-14 19:32 [PATCH] drm/i915/gt: Use IS_ERR() check for kernel_context() in selftests Ingyu Jang
2026-05-16 0:29 ` Claude Code Review Bot [this message]
2026-05-16 0:29 ` 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-20260514193227.2472962-1-ingyujang25@korea.ac.kr \
--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