drm/amdgpu: fix error checking in amdgpu_read_mm_registers for soc21
authorjsg <jsg@openbsd.org>
Tue, 28 Mar 2023 00:12:19 +0000 (00:12 +0000)
committerjsg <jsg@openbsd.org>
Tue, 28 Mar 2023 00:12:19 +0000 (00:12 +0000)
From Alex Deucher
a11e210dc595a8b7259335a9d7c7b57cc8f39bd4 in linux-6.1.y/6.1.20
2915e43a033a778816fa4bc621f033576796521e in mainline linux

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

index 230e15f..00df439 100644 (file)
@@ -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,