From ebbdcb33518eb3b9b6a2b4b3b740bed65f4926d9 Mon Sep 17 00:00:00 2001 From: jsg Date: Tue, 28 Mar 2023 00:12:19 +0000 Subject: [PATCH] drm/amdgpu: fix error checking in amdgpu_read_mm_registers for soc21 From Alex Deucher a11e210dc595a8b7259335a9d7c7b57cc8f39bd4 in linux-6.1.y/6.1.20 2915e43a033a778816fa4bc621f033576796521e in mainline linux --- sys/dev/pci/drm/amd/amdgpu/soc21.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/dev/pci/drm/amd/amdgpu/soc21.c b/sys/dev/pci/drm/amd/amdgpu/soc21.c index 230e15fed75..00df439ed49 100644 --- a/sys/dev/pci/drm/amd/amdgpu/soc21.c +++ b/sys/dev/pci/drm/amd/amdgpu/soc21.c @@ -254,9 +254,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, -- 2.20.1