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/mgag200: reject pixel clocks outside PLL range
Date: Mon, 18 May 2026 16:11:33 +1000	[thread overview]
Message-ID: <review-patch1-28e476e896dafdd31518dc5360ab7766@berkoc.com> (raw)
In-Reply-To: <28e476e896dafdd31518dc5360ab7766@berkoc.com>

Patch Review

**Correctness: Good.** The check is placed at exactly the right spot — after the search loop exhausts all candidates and before the results are written to `pixpllc->m/n/p/s`. The tolerance formula `clock * 5 / 1000` (0.5% of the requested clock) matches the g200se reference at `mgag200_g200se.c:140` and `mgag200_g200se.c:232`. Verified across all six files that the insertion point is between the end of the search loop and the `pixpllc->m = m` assignment.

**Why the bug matters:** In `atomic_update`, the register values are derived as e.g. `pixpllcm = pixpllc->m - 1` (`mgag200_g200eh.c:112`). With `m = 0`, this underflows to `0xffffffff` (truncated to a `u8`), producing corrupted PLL register writes.

**Style concern — `pr_warn` vs `drm_warn`:** The patch uses bare `pr_warn("PLL delta too large\n")` to match the g200se reference. However, the rest of the driver consistently uses `drm_err`/`drm_warn`/`drm_dbg` (which prepend device identification). A `struct drm_device *` is available in `atomic_check` via `crtc->dev`. This is a pre-existing issue in g200se too, but since six new call sites are being added, it would be worth upgrading to:

```c
drm_warn(crtc->dev, "PLL delta too large\n");
```

across all seven sites (the six new ones plus the existing g200se). This makes log messages attributable to a specific device, which matters on multi-GPU or multi-BMC systems.

**Minor functional observation:** The `pr_warn` fires during `atomic_check`, which is a validation path — userspace probing supported modes will trigger this message for any unsupported clock. This could be chatty. A `drm_dbg_kms` might be more appropriate, since the `-EINVAL` return already communicates the rejection to the DRM core. The g200se code has the same issue, so this is more of a follow-up suggestion than a blocker for this patch.

**No logic bugs found.** The patch is a straightforward, correct backport of the existing g200se pattern to the six files that were missing it. The integer arithmetic is safe for the clock ranges these PLLs support (VCO maxima are all under 1.6 GHz = 1,600,000 kHz, so `clock * 5` won't overflow a `long`).

**Verdict:** The patch fixes a real bug with the right approach. Suggest switching `pr_warn` to `drm_dbg_kms(crtc->dev, ...)` (or at minimum `drm_warn(crtc->dev, ...)`), but the logic itself is correct and ready.

---
Generated by Claude Code Patch Reviewer

  reply	other threads:[~2026-05-18  6:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-17 13:03 [PATCH] drm/mgag200: reject pixel clocks outside PLL range Berkant Koc
2026-05-18  6:11 ` Claude Code Review Bot [this message]
2026-05-18  6:11 ` 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-28e476e896dafdd31518dc5360ab7766@berkoc.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