AMD General Best Regards, Thomas -----Original Message----- From: amd-gfx <[email protected]> On Behalf Of Ce Sun Sent: Friday, July 24, 2026 8:25 AM To: [email protected] Cc: Zhang, Hawking <[email protected]>; Chai, Thomas <[email protected]>; Zhou1, Tao <[email protected]>; Yang, Stanley <[email protected]>; Sun, Ce(Overlord) <[email protected]> Subject: [PATCH 2/2] drm/amdgpu: normalize error return of RAS command wrapper functions
normalize error return of RAS command wrapper functions Signed-off-by: Ce Sun <[email protected]> --- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 8 ++++++-- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c index 24fd24e8d874..600f9239306d 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c @@ -1436,7 +1436,7 @@ static int amdgpu_uniras_clear_badpages_info(struct amdgpu_device *adev) &req, sizeof(req), NULL, 0); if (ret) { dev_err(adev->dev, "Failed to clear bad pages info, ret: %d\n", ret); - return ret; + return -EINVAL; } return 0; @@ -1457,6 +1457,10 @@ static int amdgpu_uniras_query_block_ecc(struct amdgpu_device *adev, ret = amdgpu_ras_mgr_handle_ras_cmd(adev, RAS_CMD__GET_BLOCK_ECC_STATUS, &req, sizeof(req), &rsp, sizeof(rsp)); + + if (ret) + return -EINVAL; + if (!ret) { [Thomas] This condition check should be no necessary. info->ce_count = rsp.ce_count; info->ue_count = rsp.ue_count; @@ -1536,7 +1540,7 @@ static int amdgpu_uniras_error_inject(struct amdgpu_device *adev, inject_req.method = info->value; return amdgpu_ras_mgr_handle_ras_cmd(adev, RAS_CMD__INJECT_ERROR, - &inject_req, sizeof(inject_req), &rsp, sizeof(rsp)); + &inject_req, sizeof(inject_req), &rsp, sizeof(rsp)) ? -EINVAL : +0; } /* wrapper of psp_ras_trigger_error */ diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c index 0d34f0eca991..686c92e96025 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c @@ -526,7 +526,7 @@ static ssize_t amdgpu_ras_cper_debugfs_read(struct file *f, char __user *buf, snapshot_req, sizeof(struct ras_cmd_cper_snapshot_req), snapshot_rsp, sizeof(struct ras_cmd_cper_snapshot_rsp)); if (r) - return r; + return -EINVAL; if (!snapshot_rsp->total_cper_num) { if (!read_header) @@ -568,7 +568,7 @@ static ssize_t amdgpu_ras_cper_debugfs_read(struct file *f, char __user *buf, record_rsp, sizeof(struct ras_cmd_cper_record_rsp)); if (r) - return r; + return -EINVAL; if (!record_rsp->real_data_size || !record_rsp->real_cper_num) break; -- 2.34.1
