]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/amdgpu: fix error checking in amdgpu_read_mm_registers for soc15
authorAlex Deucher <alexander.deucher@amd.com>
Mon, 6 Mar 2023 15:34:20 +0000 (10:34 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Mar 2023 07:50:15 +0000 (08:50 +0100)
commit 78ce86944ff4e4c7303f28a2d2abf76297e906ab upstream.

Properly skip non-existent registers as well.

Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/2442
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/amd/amdgpu/soc15.c

index 7cd17dda32ceb3026425c8db3e293f19b7613ec5..2eddd7f6cd41e02564ea079a0a9d08b67d697cd8 100644 (file)
@@ -439,8 +439,9 @@ static int soc15_read_register(struct amdgpu_device *adev, u32 se_num,
        *value = 0;
        for (i = 0; i < ARRAY_SIZE(soc15_allowed_read_registers); i++) {
                en = &soc15_allowed_read_registers[i];
-               if (adev->reg_offset[en->hwip][en->inst] &&
-                       reg_offset != (adev->reg_offset[en->hwip][en->inst][en->seg]
+               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;