From: jsg Date: Tue, 28 Mar 2023 00:10:35 +0000 (+0000) Subject: drm/amdgpu: fix error checking in amdgpu_read_mm_registers for soc15 X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=99f06dfc57253f463bf367b4e81fe63b5f8ef4eb;p=openbsd drm/amdgpu: fix error checking in amdgpu_read_mm_registers for soc15 From Alex Deucher 39190482e5d0993f237d6a2b54f5548d92156d50 in linux-6.1.y/6.1.20 0dcdf8498eae2727bb33cef3576991dc841d4343 in mainline linux --- diff --git a/sys/dev/pci/drm/amd/amdgpu/soc15.c b/sys/dev/pci/drm/amd/amdgpu/soc15.c index 3c1ad8a0027..266f1ab7d22 100644 --- a/sys/dev/pci/drm/amd/amdgpu/soc15.c +++ b/sys/dev/pci/drm/amd/amdgpu/soc15.c @@ -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;