From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: drm/radeon: avoid printing NULL strings Date: Sat, 16 May 2026 09:25:35 +1000 Message-ID: In-Reply-To: <20260515091054.529610-1-arnd@kernel.org> References: <20260515091054.529610-1-arnd@kernel.org> <20260515091054.529610-1-arnd@kernel.org> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Patch Review **Correctness: The fix works but changes behavior.** The sub-functions (`evergreen_surface_check_1d`, `evergreen_surface_check_2= d`, `evergreen_surface_check_linear_aligned`) all use `prefix` in two ways: 1. As a **gate** for printing: `if (prefix) { dev_warn(...); }` =E2=80=94 w= hen `prefix` is NULL, the warning message is suppressed entirely. 2. As a **string** in the format: `%s ... prefix`. By changing `NULL` to `""`, the patch silences the compiler warning but als= o changes the runtime semantics: previously, these call sites would **silen= tly return -EINVAL** on validation failure (since `if (prefix)` is false fo= r NULL). Now, `if (prefix)` evaluates to true for `""` (it's a non-NULL poi= nter), so the `dev_warn()` messages **will fire** on validation errors. ```c // In evergreen_surface_check_1d (line 238): if ((surf->nbx & (palign - 1))) { if (prefix) { // <-- was skipped when NULL, now enters with "" dev_warn(p->dev, "%s:%d %s pitch %d invalid ...", __func__, __LINE__, prefix, ...); } return -EINVAL; } ``` The three affected call sites are at: - **Line 597** (`evergreen_cs_track_validate_stencil`): This is followed by= a retry path with `"stencil"` prefix, so emitting an extra warning before = the retry is mildly noisy but not harmful. - **Line 826** (`evergreen_cs_track_validate_texture`): This call is used o= nly to compute alignment (`surf.halign`), and the return value is ignored = =E2=80=94 so the warning path is never reached in practice. No behavioral c= hange. - **Line 889** (`evergreen_cs_track_validate_texture`, mipmap path): Simila= r to line 597 =E2=80=94 the return value is discarded (`evergreen_surface_c= heck(p, &surf, "")` with no `r =3D`), so warnings would fire but the error = is silently swallowed. No functional change, but new log noise is possible. Additionally, `evergreen_surface_check` itself has a `default` case at **li= ne 315** that uses `prefix` in a `dev_warn` **without** the `if (prefix)` g= uard: ```c default: dev_warn(p->dev, "%s:%d %s invalid array mode %d\n", __func__, __LINE__, prefix, surf->mode); ``` This is the actual path gcc is warning about =E2=80=94 and the fix correctl= y addresses it since `""` is safe to print via `%s`. **Verdict:** The patch is **correct for the stated purpose** (fixing the bu= ild warning) and is practically harmless in the radeon driver (this is lega= cy command-submission validation code for old userspace). The behavioral nu= ance of enabling previously-suppressed `dev_warn` messages is unlikely to m= atter in practice, but it's worth the author/maintainer being aware of it. = An alternative would be to add `if (prefix)` guards to the `default` case i= n `evergreen_surface_check()` (line 315) so that the NULL-means-silent conv= ention is preserved. That said, the current approach is simpler and this is= frozen legacy code, so the pragmatic fix is reasonable. **Reviewed-by assessment:** Acceptable for merge as-is. The Fixes tag corre= ctly references the commit that introduced these call sites. --- Generated by Claude Code Patch Reviewer