public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH] drm/radeon/cik: fix endian cik_cp_gfx_load_microcode()
@ 2026-03-11 17:14 Ben Dooks
  2026-03-11 20:49 ` Claude review: " Claude Code Review Bot
  2026-03-11 20:49 ` Claude Code Review Bot
  0 siblings, 2 replies; 3+ messages in thread
From: Ben Dooks @ 2026-03-11 17:14 UTC (permalink / raw)
  To: dri-devel, amd-gfx, alexander.deucher, christian.koenig
  Cc: linux-kernel, airlied, simona, Ben Dooks

The cik_cp_gfx_load_microcode() has __be32 in one of
the paths where it is assigning to an __le32. This looks
to be a copy error from the other branch of the if in
that code.

Fix the following sparse warning by changing to __le32:

drivers/gpu/drm/radeon/cik.c:3926:25: warning: incorrect type in assignment (different base types)
drivers/gpu/drm/radeon/cik.c:3926:25:    expected restricted __le32 const [usertype] *[assigned] fw_data
drivers/gpu/drm/radeon/cik.c:3926:25:    got restricted __be32 const [usertype] *

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
---
 drivers/gpu/drm/radeon/cik.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
index 51a3e0fc2f56..1f9167d5ec6e 100644
--- a/drivers/gpu/drm/radeon/cik.c
+++ b/drivers/gpu/drm/radeon/cik.c
@@ -3923,7 +3923,7 @@ static int cik_cp_gfx_load_microcode(struct radeon_device *rdev)
 		WREG32(CP_CE_UCODE_ADDR, le32_to_cpu(ce_hdr->header.ucode_version));
 
 		/* ME */
-		fw_data = (const __be32 *)
+		fw_data = (const __le32 *)
 			(rdev->me_fw->data + le32_to_cpu(me_hdr->header.ucode_array_offset_bytes));
 		fw_size = le32_to_cpu(me_hdr->header.ucode_size_bytes) / 4;
 		WREG32(CP_ME_RAM_WADDR, 0);
-- 
2.37.2.352.g3c44437643


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Claude review: drm/radeon/cik: fix endian cik_cp_gfx_load_microcode()
  2026-03-11 17:14 [PATCH] drm/radeon/cik: fix endian cik_cp_gfx_load_microcode() Ben Dooks
  2026-03-11 20:49 ` Claude review: " Claude Code Review Bot
@ 2026-03-11 20:49 ` Claude Code Review Bot
  1 sibling, 0 replies; 3+ messages in thread
From: Claude Code Review Bot @ 2026-03-11 20:49 UTC (permalink / raw)
  To: dri-devel-reviews

Overall Series Review

Subject: drm/radeon/cik: fix endian cik_cp_gfx_load_microcode()
Author: Ben Dooks <ben.dooks@codethink.co.uk>
Patches: 1
Reviewed: 2026-03-12T06:49:18.100933

---

This is a single-patch series that fixes a trivial but clear endianness type mismatch in the radeon CIK driver's CP GFX microcode loading function. The fix is correct, obvious, and low-risk.

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Claude review: drm/radeon/cik: fix endian cik_cp_gfx_load_microcode()
  2026-03-11 17:14 [PATCH] drm/radeon/cik: fix endian cik_cp_gfx_load_microcode() Ben Dooks
@ 2026-03-11 20:49 ` Claude Code Review Bot
  2026-03-11 20:49 ` Claude Code Review Bot
  1 sibling, 0 replies; 3+ messages in thread
From: Claude Code Review Bot @ 2026-03-11 20:49 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

**Verdict: Correct and straightforward fix.**

The variable `fw_data` is declared as `const __le32 *` at line 3900. In the new firmware header path (the `if` branch), the PFP and CE sections correctly cast to `(const __le32 *)`, but the ME section incorrectly casts to `(const __be32 *)`:

```c
/* PFP */
fw_data = (const __le32 *)    // correct
    (rdev->pfp_fw->data + ...);

/* CE */
fw_data = (const __le32 *)    // correct
    (rdev->ce_fw->data + ...);

/* ME */
fw_data = (const __be32 *)    // BUG - should be __le32
    (rdev->me_fw->data + ...);
```

This is clearly a copy-paste error from the `else` branch (lines 3934-3957), which handles legacy firmware format using `__be32`. In the new-format branch, all firmware data uses `le32_to_cpup()` for reading (line 3931), so the cast must be `__le32 *` to match.

The fix changes the cast to `(const __le32 *)`, consistent with the PFP and CE casts above it and with the `le32_to_cpup()` usage that follows. This has no runtime impact since the cast is just a pointer type annotation — the underlying data and byte-swap operations are unchanged — but it silences a legitimate sparse warning and makes the code correctly self-documenting.

**No issues found.** Reviewed-by worthy.

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-03-11 20:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-11 17:14 [PATCH] drm/radeon/cik: fix endian cik_cp_gfx_load_microcode() Ben Dooks
2026-03-11 20:49 ` Claude review: " Claude Code Review Bot
2026-03-11 20:49 ` Claude Code Review Bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox