Add an explicit check on cmd->resp.status after psp_cmd_submit_buf()
returns to ensure PTL state is only updated on actual success.
Signed-off-by: Perry Yuan <perry.yuan@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Yifan Zhang <yifan1.zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
if (ret)
goto out;
+ /*
+ * Check response status explicitly to avoid
+ * updating cached PTL state with invalid data.
+ */
+ if (cmd->resp.status) {
+ dev_err(psp->adev->dev,
+ "PTL command 0x%x failed, PSP response status: 0x%X\n",
+ req_code, cmd->resp.status);
+ ret = -EIO;
+ goto out;
+ }
+
/* Parse response */
switch (req_code) {
case PSP_PTL_PERF_MON_QUERY: