From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/scdc-helper: Implement parsing and printing HDMI 2.1 fields
Date: Mon, 25 May 2026 21:49:33 +1000 [thread overview]
Message-ID: <review-patch3-20260520-scdc-link-health-v2-3-511af18cd64b@collabora.com> (raw)
In-Reply-To: <20260520-scdc-link-health-v2-3-511af18cd64b@collabora.com>
Patch Review
This patch extends for HDMI 2.1's FRL mode, adding lane 3 support, FRL rate, FFE levels, and status flags 1/2. Several bugs here:
**1. BUG: Lane 3 error counter missing `SCDC_CHANNEL_VALID` check**
```c
if (num_lanes == 4)
counter[3] = buf[ERR_DET_OFF(SCDC_ERR_DET_3_L)] |
(buf[ERR_DET_OFF(SCDC_ERR_DET_3_H)] & ~SCDC_CHANNEL_VALID) << 8;
else
counter[3] = 0;
```
Channels 0–2 check `if (buf[i + 1] & SCDC_CHANNEL_VALID)` before using the counter value, setting it to 0 if invalid. Lane 3 unconditionally uses the value. This should mirror the existing pattern:
```c
if (num_lanes == 4) {
if (buf[ERR_DET_OFF(SCDC_ERR_DET_3_H)] & SCDC_CHANNEL_VALID)
counter[3] = buf[ERR_DET_OFF(SCDC_ERR_DET_3_L)] |
(buf[ERR_DET_OFF(SCDC_ERR_DET_3_H)] & ~SCDC_CHANNEL_VALID) << 8;
else
counter[3] = 0;
}
```
**2. BUG: Lane 3 error counters not cleared on write-back**
After reading, the loop zeroes `buf[0..5]` (channels 0–2) and `buf[6]` (checksum), but `buf[7]` and `buf[8]` (lane 3) are left with their original read values. The subsequent write-back:
```c
return drm_scdc_write(connector->ddc, SCDC_ERR_DET_0_L, buf, buf_sz);
```
writes those un-cleared values back, so lane 3 counters are never reset. Add:
```c
buf[ERR_DET_OFF(SCDC_ERR_DET_3_L)] = 0;
buf[ERR_DET_OFF(SCDC_ERR_DET_3_H)] = 0;
```
before the write-back (and after extracting the counter value).
**3. Checksum scope for 4-lane case — verify against HDMI 2.1 spec**
```c
for (i = 0; i < buf_sz; i++)
sum = wrapping_add(u8, sum, buf[i]);
```
For `buf_sz = 9` (4 lanes), this sums registers 0x50–0x58 including the lane 3 bytes. The HDMI 2.0 checksum at register 0x56 was designed to make bytes 0x50–0x56 sum to zero. If the HDMI 2.1 spec extends the checksum to cover 0x50–0x58, this is correct. If it doesn't, this will produce false `EPROTO` failures whenever lane 3 has non-zero error counts. Please verify this matches the HDMI 2.1 spec — the code should have a comment citing the relevant spec section.
**4. `drm_scdc_frl_rate_str` returns NULL in default case**
```c
default:
return NULL;
```
This value is passed to `seq_printf` via `scdc_print_str` with `%s`. While the default case should be unreachable (all 4-bit values are covered by the enum), returning NULL for `%s` is a latent kernel-oops-in-waiting. Return `"(Unknown)"` instead, or add a `WARN_ON` and return a string.
**5. `drm_scdc_read_status1_2_flags` — same clear-before-read pattern**
```c
ret = drm_scdc_writeb(connector->ddc, SCDC_UPDATE_0, SCDC_FLT_UPDATE);
```
Same concern as patch 1's `drm_scdc_read_status0_flags` — the FLT_UPDATE flag is cleared before reading STATUS_FLAGS_1/2. For debugfs, fine; as a public API, document the behavior.
**6. Minor: `__pure` on `static inline` function**
```c
static inline __pure int drm_scdc_num_frl_lanes(enum drm_scdc_frl_rate rate)
```
`__pure` on a `static inline` is redundant — the compiler already has full visibility of the function body. It's harmless but unnecessary.
---
**Summary**: The series needs fixes for the lane 3 error counter bugs (missing valid check, missing clear-on-writeback), removal of the inappropriate comment, and ideally a spec citation for the 4-lane checksum scope. The bitfield portability concern should at least be acknowledged. The overall feature is useful and the design is sound.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-05-25 11:49 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-20 13:35 [PATCH v2 0/3] Add SCDC information to connector debugfs Nicolas Frattaroli
2026-05-20 13:35 ` [PATCH v2 1/3] drm/scdc-helper: Add scdc_status debugfs entry Nicolas Frattaroli
2026-05-25 11:49 ` Claude review: " Claude Code Review Bot
2026-05-20 13:35 ` [PATCH v2 2/3] drm/display: bridge_connector: init scdc debugfs for HDMI Nicolas Frattaroli
2026-05-25 11:49 ` Claude review: " Claude Code Review Bot
2026-05-20 13:35 ` [PATCH v2 3/3] drm/scdc-helper: Implement parsing and printing HDMI 2.1 fields Nicolas Frattaroli
2026-05-22 17:38 ` Daniel Stone
2026-05-25 11:49 ` Claude Code Review Bot [this message]
2026-05-25 11:49 ` Claude review: Add SCDC information to connector debugfs Claude Code Review Bot
-- strict thread matches above, loose matches on Subject: below --
2026-05-26 10:19 [PATCH v3 0/4] " Nicolas Frattaroli
2026-05-26 10:20 ` [PATCH v3 4/4] drm/scdc-helper: Implement parsing and printing HDMI 2.1 fields Nicolas Frattaroli
2026-05-27 5:01 ` Claude review: " Claude Code Review Bot
2026-05-27 14:03 [PATCH v4 0/4] Add SCDC information to connector debugfs Nicolas Frattaroli
2026-05-27 14:03 ` [PATCH v4 4/4] drm/scdc-helper: Implement parsing and printing HDMI 2.1 fields Nicolas Frattaroli
2026-05-28 2:16 ` 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-patch3-20260520-scdc-link-health-v2-3-511af18cd64b@collabora.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