drm/amdgpu: fix unchecked return value warning for amdgpu_gfx
authorjsg <jsg@openbsd.org>
Fri, 11 Oct 2024 02:34:46 +0000 (02:34 +0000)
committerjsg <jsg@openbsd.org>
Fri, 11 Oct 2024 02:34:46 +0000 (02:34 +0000)
From Tim Huang
deb78dc859ddba6770186fc0cf59c47487c33c9b in linux-6.6.y/6.6.55
c0277b9d7c2ee9ee5dbc948548984f0fbb861301 in mainline linux

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

index c4b5544..96f83c1 100644 (file)
@@ -795,8 +795,11 @@ int amdgpu_gfx_ras_late_init(struct amdgpu_device *adev, struct ras_common_if *r
        int r;
 
        if (amdgpu_ras_is_supported(adev, ras_block->block)) {
-               if (!amdgpu_persistent_edc_harvesting_supported(adev))
-                       amdgpu_ras_reset_error_status(adev, AMDGPU_RAS_BLOCK__GFX);
+               if (!amdgpu_persistent_edc_harvesting_supported(adev)) {
+                       r = amdgpu_ras_reset_error_status(adev, AMDGPU_RAS_BLOCK__GFX);
+                       if (r)
+                               return r;
+               }
 
                r = amdgpu_ras_block_late_init(adev, ras_block);
                if (r)
@@ -941,7 +944,10 @@ uint32_t amdgpu_kiq_rreg(struct amdgpu_device *adev, uint32_t reg)
                pr_err("critical bug! too many kiq readers\n");
                goto failed_unlock;
        }
-       amdgpu_ring_alloc(ring, 32);
+       r = amdgpu_ring_alloc(ring, 32);
+       if (r)
+               goto failed_unlock;
+
        amdgpu_ring_emit_rreg(ring, reg, reg_val_offs);
        r = amdgpu_fence_emit_polling(ring, &seq, MAX_KIQ_REG_WAIT);
        if (r)
@@ -1007,7 +1013,10 @@ void amdgpu_kiq_wreg(struct amdgpu_device *adev, uint32_t reg, uint32_t v)
        }
 
        spin_lock_irqsave(&kiq->ring_lock, flags);
-       amdgpu_ring_alloc(ring, 32);
+       r = amdgpu_ring_alloc(ring, 32);
+       if (r)
+               goto failed_unlock;
+
        amdgpu_ring_emit_wreg(ring, reg, v);
        r = amdgpu_fence_emit_polling(ring, &seq, MAX_KIQ_REG_WAIT);
        if (r)
@@ -1043,6 +1052,7 @@ void amdgpu_kiq_wreg(struct amdgpu_device *adev, uint32_t reg, uint32_t v)
 
 failed_undo:
        amdgpu_ring_undo(ring);
+failed_unlock:
        spin_unlock_irqrestore(&kiq->ring_lock, flags);
 failed_kiq_write:
        dev_err(adev->dev, "failed to write reg:%x\n", reg);