drm/amdgpu: Add put fence in amdgpu_fence_driver_clear_job_fences
authorAndrey Grodzovsky <andrey.grodzovsky@amd.com>
Mon, 20 Jun 2022 17:08:52 +0000 (13:08 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 28 Jun 2022 15:24:18 +0000 (11:24 -0400)
This function should drop the fence refcount when it extracts the
fence from the fence array, just as it's done in amdgpu_fence_process.

Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c

index 957437a..a9ae3be 100644 (file)
@@ -595,8 +595,10 @@ void amdgpu_fence_driver_clear_job_fences(struct amdgpu_ring *ring)
        for (i = 0; i <= ring->fence_drv.num_fences_mask; i++) {
                ptr = &ring->fence_drv.fences[i];
                old = rcu_dereference_protected(*ptr, 1);
-               if (old && old->ops == &amdgpu_job_fence_ops)
+               if (old && old->ops == &amdgpu_job_fence_ops) {
                        RCU_INIT_POINTER(*ptr, NULL);
+                       dma_fence_put(old);
+               }
        }
 }