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: Return errors for failed debug BO commands Date: Thu, 04 Jun 2026 16:14:42 +1000 Message-ID: In-Reply-To: <20260529162122.1976376-1-lizhi.hou@amd.com> References: <20260529162122.1976376-1-lizhi.hou@amd.com> <20260529162122.1976376-1-lizhi.hou@amd.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Patch Review **Hunk 1 =E2=80=94 `aie2_sched_drvcmd_resp_handler` refactor (lines 305=E2= =80=93321)** Good cleanup. The original code had a subtle bug: when `data` was NULL, it = jumped to `out` with `ret =3D 0` and never wrote `job->drv_cmd->result`, le= aving it at whatever the caller initialized (zero via `{ 0 }`). Callers che= ck `if (cmd.result)` to detect failure, so they'd see success. The new code: ```c if (unlikely(!data || size !=3D sizeof(u32))) { job->drv_cmd->result =3D U32_MAX; ret =3D -EINVAL; } else { job->drv_cmd->result =3D readl(data); } ``` This correctly handles both error paths: `ret =3D -EINVAL` for the return v= alue, and `U32_MAX` as the result sentinel so callers checking `cmd.result`= also see a failure. The `if/else` replacing the `goto out` pattern is clea= ner for this two-case logic. **Hunk 2 =E2=80=94 `aie2_hwctx_cfg_debug_bo` missing error return (line 940= )** This is the core bug. Before the fix: ```c aie2_cmd_wait(hwctx, seq); if (cmd.result) { XDNA_ERR(xdna, "Response failure 0x%x", cmd.result); goto put_obj; } ``` At this point `ret` is still 0 from the successful `amdxdna_cmd_submit` cal= l, so jumping to `put_obj` returns success to userspace despite logging the= error. The fix adding `ret =3D -EINVAL` is correct and matches the pattern= already used in `aie2_hwctx_sync_debug_bo` (line 994 in the tree). **Minor observation on commit message:** The commit message says "The confi= g and sync debug BO commands currently may report success even when the ope= ration fails." However, `aie2_hwctx_sync_debug_bo` already correctly return= s `-EINVAL` when `cmd.result` is non-zero (tree lines 992=E2=80=93994). The= "sync" part of the fix is only via the response handler change (the `data = =3D=3D NULL` path), not a missing error return like the config function had= . This is technically accurate but could be clearer =E2=80=94 the config fu= nction had two bugs (response handler + missing ret assignment) while the s= ync function only had the response handler one. **No other issues found.** The patch is correct and ready to merge. --- Generated by Claude Code Patch Reviewer