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/amdgpu: optimize psp_copy_fw() Date: Tue, 26 May 2026 07:30:33 +1000 Message-ID: In-Reply-To: References: X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 Patch Review **Correctness: OK** The original code: ```c memset(psp->fw_pri_buf, 0, PSP_1_MEG); memcpy(psp->fw_pri_buf, start_addr, bin_size); ``` is replaced with: ```c memcpy_and_pad(psp->fw_pri_buf, PSP_1_MEG, start_addr, bin_size, 0); ``` The `memcpy_and_pad` implementation (`lib/string_helpers.c:1004`) does: ```c if (dest_len > count) { memcpy(dest, src, count); memset(dest + count, pad, dest_len - count); } else { memcpy(dest, src, dest_len); } ``` The guard at line 4583 ensures `bin_size <= PSP_1_MEG`, so `memcpy_and_pad` will either copy `bin_size` bytes then zero-pad the remainder (when `bin_size < PSP_1_MEG`), or copy exactly `PSP_1_MEG` bytes (when equal). Both cases are semantically identical to the original. The arguments are mapped correctly: `dest=fw_pri_buf`, `dest_len=PSP_1_MEG`, `src=start_addr`, `count=bin_size`, `pad=0`. **Nits (commit message only):** - "1 Mo" should be "1 MB" (Mo is the French abbreviation for megaoctet). - "the partially re-written" should be "then partially re-written". These are cosmetic commit message issues; the code change itself is clean and correct. --- Generated by Claude Code Patch Reviewer