Skip to contentSkip to conversation

drm/amdgpu: Return -EINVAL when MMSCH init status incorrect

PATCH In review Lin.Cao 2 participants 2 messages Oct 8, 2023 – Oct 10, 2023

Subsystems (2)
lore
Share & tools
lore

Lin.Cao

author
#0 lore raw

PATCH 1/1 drm/amdgpu: Return -EINVAL when MMSCH init status incorrect

Return -EINVAL when MMSCH init fail which can be handle by function amdgpu_device_reset_sriov correctly.

---
 drivers/gpu/drm/amd/amdgpu/jpeg_v4_0.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/jpeg_v4_0.c +4 -1
index ac614b869aaf..a3768aefb6b6 100644
@@ -518,8 +518,11 @@ static int jpeg_v4_0_start_sriov(struct amdgpu_device *adev)
 			return -EBUSY;
 		}
 	}
-	if (resp != expected && resp != MMSCH_VF_MAILBOX_RESP__INCOMPLETE && init_status != MMSCH_VF_ENGINE_STATUS__PASS)
+	if (resp != expected && resp != MMSCH_VF_MAILBOX_RESP__INCOMPLETE
+			&& init_status != MMSCH_VF_ENGINE_STATUS__PASS) {
 		DRM_ERROR("MMSCH init status is incorrect! readback=0x%08x, header init status for jpeg: %x\n", resp, init_status);
+		return -EINVAL;
+	}
 
 	return 0;
 
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Signature · 2 lines
Best Regards,
JingWen Chen
Quoted 25 lines · Lin.Cao

Return -EINVAL when MMSCH init fail which can be handle by function amdgpu_device_reset_sriov correctly.

---
  drivers/gpu/drm/amd/amdgpu/jpeg_v4_0.c | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/jpeg_v4_0.c +4 -1
index ac614b869aaf..a3768aefb6b6 100644
@@ -518,8 +518,11 @@ static int jpeg_v4_0_start_sriov(struct amdgpu_device *adev)
  			return -EBUSY;
  		}
  	}
-	if (resp != expected && resp != MMSCH_VF_MAILBOX_RESP__INCOMPLETE && init_status != MMSCH_VF_ENGINE_STATUS__PASS)
+	if (resp != expected && resp != MMSCH_VF_MAILBOX_RESP__INCOMPLETE
+			&& init_status != MMSCH_VF_ENGINE_STATUS__PASS) {
  		DRM_ERROR("MMSCH init status is incorrect! readback=0x%08x, header init status for jpeg: %x\n", resp, init_status);
+		return -EINVAL;
+	}
 
  	return 0;