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: dma-fence: Use dma_fence_set_error() internally
Date: Thu, 04 Jun 2026 11:41:50 +1000	[thread overview]
Message-ID: <review-overall-20260603150531.2217691-2-phasta@kernel.org> (raw)
In-Reply-To: <20260603150531.2217691-2-phasta@kernel.org>

Overall Series Review

Subject: dma-fence: Use dma_fence_set_error() internally
Author: Philipp Stanner <phasta@kernel.org>
Patches: 1
Reviewed: 2026-06-04T11:41:50.918398

---

This is a single-patch series making a trivial cleanup in `dma_fence_release()`: replacing a direct assignment `fence->error = -EDEADLK` with the API helper `dma_fence_set_error(fence, -EDEADLK)`. The intent is to improve readability and consistency by using the designated API.

The change is **correct but has a minor behavioral subtlety worth noting**. The `dma_fence_set_error()` helper (defined at `include/linux/dma-fence.h:686`) includes two `WARN_ON` checks:

```c
WARN_ON(test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags));
WARN_ON(error >= 0 || error < -MAX_ERRNO);
```

The second check is trivially satisfied since `-EDEADLK` is always a valid negative errno. The first check — that the fence is not already signaled — is also safe in this context because the enclosing `if` at line 581 explicitly verified `!dma_fence_test_signaled_flag(fence)` before entering the block.

There is a theoretical race window: the `!dma_fence_test_signaled_flag()` check at line 581 is done without the fence lock, and the lock is only acquired at line 601. In principle, another thread could signal the fence between the check and the lock acquisition, causing the `WARN_ON` inside `dma_fence_set_error()` to fire. **However, this same race existed before this patch** — the original code would have set the error on an already-signaled fence too, and then called `dma_fence_signal_locked()` which also has its own signaled-state handling. Furthermore, we are in `dma_fence_release()` meaning the refcount has hit zero, so concurrent signaling would be a separate bug. This patch does not make that situation any worse; the new `WARN_ON` would actually *help* detect it.

Overall: a clean, low-risk readability improvement. No functional concerns.

---
Generated by Claude Code Patch Reviewer

  reply	other threads:[~2026-06-04  1:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-03 15:05 [PATCH] dma-fence: Use dma_fence_set_error() internally Philipp Stanner
2026-06-04  1:41 ` Claude Code Review Bot [this message]
2026-06-04  1:41 ` 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-overall-20260603150531.2217691-2-phasta@kernel.org \
    --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