Add a comment to explain clearyl why in both success
and failure condition we need to put a reference to
dma_fence to avoid confusion.

Signed-off-by: Sunil Khatri <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
index f93da45cfa7e..18390d37a7e0 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
@@ -779,6 +779,7 @@ amdgpu_userq_wait_return_fence_info(struct drm_file *filp,
                        }
                }
 
+               /* Drop the reference taken from drm_syncobj_find_fence */
                dma_fence_put(fence);
        }
 
@@ -795,10 +796,11 @@ amdgpu_userq_wait_return_fence_info(struct drm_file *filp,
 
                r = amdgpu_userq_wait_add_fence(wait_info, fences,
                                                &num_fences, fence);
+
+               /* Drop the reference taken from drm_syncobj_find_fence */
                dma_fence_put(fence);
                if (r)
                        goto free_fences;
-
        }
 
        /* Lock all the GEM objects */
-- 
2.34.1

Reply via email to