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: accel/amdxdna: Use a different name for latest firmware
Date: Fri, 27 Feb 2026 12:57:27 +1000	[thread overview]
Message-ID: <review-patch1-20260225193022.2707525-1-lizhi.hou@amd.com> (raw)
In-Reply-To: <20260225193022.2707525-1-lizhi.hou@amd.com>

Patch Review

**1. Use `request_firmware_nowarn()` for the fallback probe**

The first iteration of the loop tries `npu_7.sbin`, which will not exist on systems with older firmware packages. Using `request_firmware()` will log a kernel error/warning to dmesg on every such system, alarming users with a spurious failure message. The non-final attempts should use `firmware_request_nowarn()` (or `request_firmware_direct()`) to suppress the expected failure, and only use `request_firmware()` for the final fallback.

```c
+	for (i = 0; i < ARRAY_SIZE(npu_fw); i++) {
+		fw_full_path = kasprintf(GFP_KERNEL, "%s%s", ndev->priv->fw_path,
+					 npu_fw[i]);
+		if (!fw_full_path)
+			return -ENOMEM;
+
+		ret = request_firmware(&fw, fw_full_path, &pdev->dev);
```

**2. Missing `const` qualifiers on `npu_fw[]`**

The array holds pointers to string literals. It should be `static const char * const npu_fw[]` to prevent both the pointers and the strings from being modified.

```c
+static char *npu_fw[] = {
+	"npu_7.sbin",
+	"npu.sbin"
+};
```

Should be:
```c
static const char * const npu_fw[] = {
	"npu_7.sbin",
	"npu.sbin",
};
```

Also missing a trailing comma after `"npu.sbin"` per kernel coding style.

**3. Silently dropped `MODULE_FIRMWARE("amdnpu/17f0_20/npu.sbin")`**

The patch removes the `17f0_20` MODULE_FIRMWARE entry without any explanation in the commit message:

```c
-MODULE_FIRMWARE("amdnpu/17f0_20/npu.sbin");
+MODULE_FIRMWARE("amdnpu/1502_00/npu_7.sbin");
+MODULE_FIRMWARE("amdnpu/17f0_10/npu_7.sbin");
+MODULE_FIRMWARE("amdnpu/17f0_11/npu_7.sbin");
```

If this path was previously required by some device variant, its removal is a regression. If it was stale/incorrect, that should be a separate fix or at least noted in the commit message. Additionally, no `npu_7.sbin` entry is added for `17f0_20`, which seems inconsistent.

**4. Degraded error message after firmware load failure**

When all firmware loading fails, the error message now prints just the directory prefix instead of an actual firmware filename:

```c
 	if (ret) {
 		XDNA_ERR(xdna, "failed to request_firmware %s, ret %d",
-			 ndev->priv->fw_path, ret);
+				 ndev->priv->fw_path, ret);
```

`ndev->priv->fw_path` is now `"amdnpu/1502_00/"` instead of `"amdnpu/1502_00/npu.sbin"`. The message won't tell the user which specific firmware files were tried. Consider printing the filenames that were attempted, or at minimum the last one.

**5. Unnecessary whitespace change in the error message**

The alignment of `ndev->priv->fw_path` in the error message changes from one tab to two tabs. This is a cosmetic change unrelated to the fix and adds noise to the diff.

**6. Semantic change to `fw_path` field meaning**

The `fw_path` field in `struct amdxdna_dev_priv` is changed from holding a full firmware file path to holding a directory prefix. This is a silent semantic change that could confuse future developers. The field name now no longer describes its contents. Consider renaming it to `fw_dir` or similar to make the new semantics clear.

**7. `npu_fw[]` scope is wider than necessary**

The `npu_fw[]` array is declared at module scope but only used inside `aie2_init()`. It could be declared locally within the function, or if kept at file scope, should at minimum have the `const` qualifiers mentioned above.

**8. Naming choice `npu_7.sbin`**

The commit message doesn't explain the significance of "7" in the firmware filename. A brief note on why this name was chosen (firmware version 7? protocol version 7?) would help future readers understand the naming convention.

---
Generated by Claude Code Patch Reviewer

  parent reply	other threads:[~2026-02-27  2:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-25 19:30 [PATCH V1] accel/amdxdna: Use a different name for latest firmware Lizhi Hou
2026-02-25 19:46 ` Mario Limonciello
2026-02-25 20:38   ` Lizhi Hou
2026-02-27  2:57 ` Claude Code Review Bot [this message]
2026-02-27  2:57 ` Claude review: " Claude Code Review Bot
  -- strict thread matches above, loose matches on Subject: below --
2026-02-25 20:47 [PATCH V2] " Lizhi Hou
2026-02-27  2:53 ` Claude review: " Claude Code Review Bot
2026-02-27  2:53 ` 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-20260225193022.2707525-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