From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/amd/display: use READ_ONCE() in psr_su_set_dsc_slice_height()
Date: Tue, 26 May 2026 07:36:07 +1000 [thread overview]
Message-ID: <review-patch1-ahQCfcFVMQY4JGXM@stanley.mountain> (raw)
In-Reply-To: <ahQCfcFVMQY4JGXM@stanley.mountain>
Patch Review
**Positive aspects:**
1. The duplicate zero-check is consolidated into a single check, which is cleaner.
2. The local `num_slices_v` variable ensures the value used in the division matches the value that was checked, eliminating the static checker warning.
3. The commit message correctly notes the caller ignores the return value, justifying the change from `return true` to `return false` for the zero case.
**Concerns:**
1. **READ_ONCE() alone doesn't fix a real race.** If `num_slices_v` can genuinely change concurrently, then `v_addressable`, `v_border_top`, and `v_border_bottom` are read from the same `stream->timing` without any protection:
```c
pic_height = stream->timing.v_addressable +
stream->timing.v_border_top + stream->timing.v_border_bottom;
```
A concurrent update to the timing struct could make `pic_height` and `num_slices_v` inconsistent with each other. `READ_ONCE()` on one field creates a false sense of safety. If this is truly racy, proper locking is needed.
2. **Behavioral change in return value.** The original code returned `true` when `num_slices_v == 0` (in the early compound guard). The patch now returns `false`. The commit message acknowledges this and correctly notes the only caller discards the return value (line 90). This is fine today, but if a future caller starts checking the return value, it could be surprising that the semantics changed. A brief inline comment on the `return false` wouldn't hurt, but isn't essential.
3. **The commit message says "there is a race condition" but this is speculative.** The duplicate check (commit `21fc0ff38f57`) was more likely added as a defensive guard against a NULL/zero path that was hit during testing — not necessarily due to concurrency. The original fix commit message says "fix a divided-by-zero error", not "fix a race". The `READ_ONCE()` may be solving the wrong problem. That said, it doesn't make things worse.
**Minor nit:**
The commit message says "In the original code we returns true" — minor grammar ("we return" or "it returns").
**Verdict:** Low risk, acceptable as a static-checker cleanup. The `READ_ONCE()` is harmless but shouldn't be taken as evidence that the race theory is correct or that this area is now concurrency-safe. If real races exist here, a follow-up with proper locking would be needed.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-05-25 21:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-25 8:04 [PATCH] drm/amd/display: use READ_ONCE() in psr_su_set_dsc_slice_height() Dan Carpenter
2026-05-25 21:36 ` Claude Code Review Bot [this message]
2026-05-25 21:36 ` 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-ahQCfcFVMQY4JGXM@stanley.mountain \
--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