drm/amdgpu: fix error checking in amdgpu_read_mm_registers for nv
authorjsg <jsg@openbsd.org>
Tue, 28 Mar 2023 00:13:59 +0000 (00:13 +0000)
committerjsg <jsg@openbsd.org>
Tue, 28 Mar 2023 00:13:59 +0000 (00:13 +0000)
From Alex Deucher
d07d152d762d746016f546f9fedd3f319870cf5e in linux-6.1.y/6.1.20
b42fee5e0b44344cfe4c38e61341ee250362c83f in mainline linux

sys/dev/pci/drm/amd/amdgpu/nv.c

index 6853b93..df3388e 100644 (file)
@@ -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,