From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/radeon/rs780: prevent division by zero in refresh rate calculation
Date: Tue, 05 May 2026 10:36:35 +1000 [thread overview]
Message-ID: <review-patch1-20260430104626.16230-1-evg28bur@yandex.ru> (raw)
In-Reply-To: <20260430104626.16230-1-evg28bur@yandex.ru>
Patch Review
**Correctness of the fix in `rs780_get_pm_mode_parameters()`:** The fallback to 60Hz when `drm_mode_vrefresh()` returns 0 is sensible and consistent with the existing default at line 59:
```c
/* defaults */
pi->refresh_rate = 60;
```
The code already sets 60 as the default before the loop, so falling back to 60 when `drm_mode_vrefresh()` returns an unusable value is the right thing to do.
**Issue 1 — The `WARN_ON` in `rs780_program_at()` is unnecessary and arguably wrong.** With the fix in `rs780_get_pm_mode_parameters()`, `refresh_rate` should never be 0 when `rs780_program_at()` is reached. Adding a `WARN_ON` for a condition the code already prevents is defensive noise. More importantly, the `WARN_ON` fires but execution continues, so if somehow `refresh_rate` were 0, the division-by-zero would still happen on the very next line. It doesn't actually *protect* against anything — it just adds a warning before the crash. If the intent is belt-and-suspenders, a `WARN_ON` with a return would be needed:
```c
if (WARN_ON(pi->refresh_rate == 0))
return;
```
But even that is over-engineering given the fix in the getter. I'd recommend dropping the `WARN_ON` entirely to keep the patch minimal and focused.
**Issue 2 — Commit message claims "mode clock validation" was added, but no clock check exists in the diff.** The commit message says "Fix by adding mode clock validation and fallback to default 60Hz." The actual fix just checks the return value of `drm_mode_vrefresh()` — it does not validate `mode->clock` directly. The commit message should match what the code actually does.
**Issue 3 — `Cc: stable` / routing concern.** The patch is addressed `To: stable@vger.kernel.org` and Greg KH, suggesting it's being submitted as a stable-only patch or a direct backport request. However, the normal kernel workflow is to get the fix merged in mainline first (via the drm/radeon maintainers), and then request stable backport with a `Cc: stable@vger.kernel.org` tag. Sending directly to stable is not the usual process and will likely be rejected. This should go through the `amd-gfx` / `dri-devel` maintainer flow first.
**Issue 4 — The `Reported-by` / `Closes` tags reference a kbuild bot report, but the commit message says "Found by Linux Verification Center (linuxtesting.org) with SVACE."** These are two different tools/reporters. If the bug was found by SVACE, the `Reported-by` should reflect that. If the kbuild bot independently reported it as well, that's fine as an additional tag, but the attribution is confusing as written.
**Minor style nit:** The added braces around the `if` block are correct per kernel coding style (multi-statement body requires braces), so that part is fine.
**Summary:** The core fix (fallback to 60Hz on zero return from `drm_mode_vrefresh()`) is correct and appropriate. The `WARN_ON` should be dropped or converted to a `WARN_ON` + early return. The commit message needs to accurately describe what was done, and the submission routing needs to follow the normal mainline-first workflow.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-05-05 0:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-30 10:46 [PATCH] drm/radeon/rs780: prevent division by zero in refresh rate calculation Evgenii Burenchev
2026-05-05 0:36 ` Claude Code Review Bot [this message]
2026-05-05 0: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-20260430104626.16230-1-evg28bur@yandex.ru \
--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