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/scdc-helper: Add scdc_status debugfs entry
Date: Fri, 05 Jun 2026 06:21:28 +1000	[thread overview]
Message-ID: <review-patch2-20260604-scdc-link-health-v5-2-11173b0ac3de@collabora.com> (raw)
In-Reply-To: <20260604-scdc-link-health-v5-2-11173b0ac3de@collabora.com>

Patch Review

This is the core patch and has a few issues:

**Bug: Off-by-one in SCDC read misses register 0xFF.**

```c
ret = drm_scdc_read(ddc, 0, buf, 128);
if (ret)
    return ret;

ret = drm_scdc_read(ddc, 127, &buf[127], 128);
```

The first read covers registers `0x00–0x7F`. The second reads from offset 127 (`0x7F`) for 128 bytes, covering `0x7F–0xFE`. Register `0xFF` is never read, and byte 127 is read twice (second overwrites first). The doc comment says "Reads the entire 256 byte SCDC state" but it only reads 255 registers. The hex dump then prints all 256 bytes including the unread byte 255 (which will be stale or zero).

The fix should be:
```c
ret = drm_scdc_read(ddc, 128, &buf[128], 128);
```

**Issue: `drm_connector_put()` placed mid-function on success path.**

```c
scdc_print_flag(m, "Low Rate Scrambling Supported", scdc->scrambling.low_rates);

drm_connector_put(connector);  // <-- refcount dropped here

scdc_print_flag(m, "Scrambling Enabled", st->scrambling_enabled);
// ... 10 more lines accessing st-> ...

return 0;

err_conn_put:
    drm_connector_put(connector);
    return ret;
```

The refcount is technically balanced (one get, one put per path), and the code after the put only accesses `st` (which lives in `priv`, not the connector), so it's memory-safe. But dropping the connector ref before the function completes is an unusual pattern. If future changes access `connector` or `scdc` below this point, they'd hit a use-after-potential-free. Consider moving the `put` to just before `return 0`, or restructuring with a single exit path.

**Minor: Typo in kdoc.**

```c
/** @scramling_enabled: true if TMDS scrambling is on */
bool scrambling_enabled;
```

Should be `@scrambling_enabled` (missing 'b').

**Minor: `drm_scdc_status_flags` struct fields have no kdoc.** The `drm_scdc_state` members are documented, but the nested `drm_scdc_status_flags` fields are not. Since these structs are in a public header and `drm_scdc_read_state` is exported, adding kdoc would be good practice.

---

---
Generated by Claude Code Patch Reviewer

  reply	other threads:[~2026-06-04 20:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-04 15:52 [PATCH v5 0/4] Add SCDC information to connector debugfs Nicolas Frattaroli
2026-06-04 15:52 ` [PATCH v5 1/4] drm/scdc-helper: Don't use ssize_t return type for scdc_read/write Nicolas Frattaroli
2026-06-04 20:21   ` Claude review: " Claude Code Review Bot
2026-06-04 15:52 ` [PATCH v5 2/4] drm/scdc-helper: Add scdc_status debugfs entry Nicolas Frattaroli
2026-06-04 20:21   ` Claude Code Review Bot [this message]
2026-06-04 15:52 ` [PATCH v5 3/4] drm/display: bridge_connector: init scdc debugfs for HDMI Nicolas Frattaroli
2026-06-04 20:21   ` Claude review: " Claude Code Review Bot
2026-06-04 15:52 ` [PATCH v5 4/4] drm/scdc-helper: Implement parsing and printing HDMI 2.1 fields Nicolas Frattaroli
2026-06-04 20:21   ` Claude review: " Claude Code Review Bot
2026-06-04 20:21 ` Claude review: Add SCDC information to connector debugfs Claude Code Review Bot
  -- strict thread matches above, loose matches on Subject: below --
2026-05-27 14:03 [PATCH v4 0/4] " Nicolas Frattaroli
2026-05-27 14:03 ` [PATCH v4 2/4] drm/scdc-helper: Add scdc_status debugfs entry Nicolas Frattaroli
2026-05-28  2:16   ` Claude review: " Claude Code Review Bot
2026-05-26 10:19 [PATCH v3 0/4] Add SCDC information to connector debugfs Nicolas Frattaroli
2026-05-26 10:19 ` [PATCH v3 2/4] drm/scdc-helper: Add scdc_status debugfs entry Nicolas Frattaroli
2026-05-27  5:01   ` Claude review: " Claude Code Review Bot
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

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-patch2-20260604-scdc-link-health-v5-2-11173b0ac3de@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