summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/amdgpu/soc21.c
diff options
context:
space:
mode:
authorAlex Deucher <alexander.deucher@amd.com>2023-03-06 18:35:34 +0300
committerAlex Deucher <alexander.deucher@amd.com>2023-03-07 22:22:42 +0300
commitba137e64191f313eb0e91eeb9a1a2db1b1d5234f (patch)
treebdb0ce1a6c36ef307f8092e413963bbfd7ab523c /drivers/gpu/drm/amd/amdgpu/soc21.c
parentf651a7b64cec907bd645dd7ce1739fbbe257bceb (diff)
downloadlinux-ba137e64191f313eb0e91eeb9a1a2db1b1d5234f.tar.xz
drm/amdgpu: fix error checking in amdgpu_read_mm_registers for soc21
Properly skip non-existent registers as well. Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/2442 Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/soc21.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/soc21.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/soc21.c b/drivers/gpu/drm/amd/amdgpu/soc21.c
index 620f7409825d..9df2236007ab 100644
--- a/drivers/gpu/drm/amd/amdgpu/soc21.c
+++ b/drivers/gpu/drm/amd/amdgpu/soc21.c
@@ -291,9 +291,10 @@ static int soc21_read_register(struct amdgpu_device *adev, u32 se_num,
*value = 0;
for (i = 0; i < ARRAY_SIZE(soc21_allowed_read_registers); i++) {
en = &soc21_allowed_read_registers[i];
- if (adev->reg_offset[en->hwip][en->inst] &&
- reg_offset != (adev->reg_offset[en->hwip][en->inst][en->seg]
- + en->reg_offset))
+ if (!adev->reg_offset[en->hwip][en->inst])
+ continue;
+ else if (reg_offset != (adev->reg_offset[en->hwip][en->inst][en->seg]
+ + en->reg_offset))
continue;
*value = soc21_get_register_value(adev,