From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: accel/amdxdna: Use a different name for latest firmware
Date: Fri, 27 Feb 2026 12:53:21 +1000 [thread overview]
Message-ID: <review-patch1-20260225204752.2711734-1-lizhi.hou@amd.com> (raw)
In-Reply-To: <20260225204752.2711734-1-lizhi.hou@amd.com>
Patch Review
**1. Missing `const` qualifiers on `npu_fw` array**
```c
static char *npu_fw[] = {
"npu_7.sbin",
"npu.sbin"
};
```
This should be `static const char * const npu_fw[]`. Both the pointers and the pointed-to strings are string literals and should never be modified. The kernel's `-Wwrite-strings` warning and general const-correctness conventions expect this.
**2. Misleading error message after `fw_path` semantic change**
The `fw_path` field has been changed from a full firmware path (e.g., `"amdnpu/1502_00/npu.sbin"`) to a directory prefix (e.g., `"amdnpu/1502_00/"`). But the error message after the loop is unchanged:
```c
if (ret) {
XDNA_ERR(xdna, "failed to request_firmware %s, ret %d",
ndev->priv->fw_path, ret);
```
This will now print something like `"failed to request_firmware amdnpu/1502_00/, ret -2"` which is incomplete — it doesn't tell the user which firmware files were actually attempted. Consider logging all attempted names, e.g.:
```c
XDNA_ERR(xdna, "failed to load firmware from %s (tried %s, %s), ret %d",
ndev->priv->fw_path, npu_fw[0], npu_fw[1], ret);
```
Or alternatively, log each individual failure at `dev_dbg` level inside the loop.
**3. Missing `MODULE_FIRMWARE` for `17f0_20/npu_7.sbin`**
The existing code declares `MODULE_FIRMWARE("amdnpu/17f0_20/npu.sbin")` but the patch does not add a corresponding `MODULE_FIRMWARE("amdnpu/17f0_20/npu_7.sbin")`. Since the firmware loading loop is global (applies to all NPU variants), any device using the `17f0_20` directory will also attempt to load `npu_7.sbin`. The `MODULE_FIRMWARE` declarations should match what the driver may try to load so that packaging tools (like `dracut`, `mkinitcpio`) can include the right files. If `17f0_20` genuinely does not have an `npu_7.sbin` firmware, a comment explaining why would be helpful.
**4. `XDNA_INFO` on every successful probe is noisy**
```c
if (!ret) {
XDNA_INFO(xdna, "Load firmware %s%s", ndev->priv->fw_path, npu_fw[i]);
break;
}
```
This prints an info-level message on every successful device probe. Typically firmware load success is logged at debug level (or not at all, since `request_firmware` already logs). Consider using `XDNA_DBG` instead, or only logging when the fallback firmware is used (i.e., `i > 0`), which is the actually interesting case.
**5. `fw_path` field name no longer reflects its meaning**
The struct field `fw_path` in `struct amdxdna_dev_priv` (defined in `aie2_pci.h:249`) previously held a full firmware path and now holds a directory prefix. The name `fw_path` is now misleading. Consider renaming it to `fw_dir` or adding a comment at the struct definition to clarify the new semantics:
```c
const char *fw_path; /* firmware directory prefix, e.g. "amdnpu/1502_00/" */
```
**6. Minor: `fw_full_path` string is constructed twice**
The firmware path string is constructed with `kasprintf` and freed, then the same concatenation is repeated in the `XDNA_INFO` format string. This is fine functionally, but you could move the `XDNA_INFO` before the `kfree` and just print `fw_full_path` for cleaner code:
```c
ret = firmware_request_nowarn(&fw, fw_full_path, &pdev->dev);
if (!ret) {
XDNA_INFO(xdna, "Loaded firmware %s", fw_full_path);
kfree(fw_full_path);
break;
}
kfree(fw_full_path);
```
**Overall**: The fix approach is sound — using a separate firmware filename with fallback is a clean way to handle the compatibility issue. The issues above are all addressable in a V3. The `const` fix and the error message fix are the most important; the rest are improvements.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-02-27 2:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-25 20:47 [PATCH V2] accel/amdxdna: Use a different name for latest firmware Lizhi Hou
2026-02-25 20:49 ` Mario Limonciello (AMD) (kernel.org)
2026-02-25 21:56 ` Lizhi Hou
2026-02-27 2:53 ` Claude Code Review Bot [this message]
2026-02-27 2:53 ` Claude review: " Claude Code Review Bot
-- strict thread matches above, loose matches on Subject: below --
2026-02-25 19:30 [PATCH V1] " Lizhi Hou
2026-02-27 2:57 ` Claude review: " Claude Code Review Bot
2026-02-27 2:57 ` 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-20260225204752.2711734-1-lizhi.hou@amd.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