From e474b851fabc5b763a376329ebb2f3e45ca613d1 Mon Sep 17 00:00:00 2001 From: jsg Date: Tue, 28 Mar 2023 00:13:59 +0000 Subject: [PATCH] drm/amdgpu: fix error checking in amdgpu_read_mm_registers for nv From Alex Deucher d07d152d762d746016f546f9fedd3f319870cf5e in linux-6.1.y/6.1.20 b42fee5e0b44344cfe4c38e61341ee250362c83f in mainline linux --- sys/dev/pci/drm/amd/amdgpu/nv.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/dev/pci/drm/amd/amdgpu/nv.c b/sys/dev/pci/drm/amd/amdgpu/nv.c index 6853b93ac82..df3388e8dec 100644 --- a/sys/dev/pci/drm/amd/amdgpu/nv.c +++ b/sys/dev/pci/drm/amd/amdgpu/nv.c @@ -393,9 +393,10 @@ static int nv_read_register(struct amdgpu_device *adev, u32 se_num, *value = 0; for (i = 0; i < ARRAY_SIZE(nv_allowed_read_registers); i++) { en = &nv_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 = nv_get_register_value(adev, -- 2.20.1