From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot 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 Message-ID: In-Reply-To: <20260225193022.2707525-1-lizhi.hou@amd.com> References: <20260225193022.2707525-1-lizhi.hou@amd.com> <20260225193022.2707525-1-lizhi.hou@amd.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 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