drm/amdgpu: fix missing dma_fence_put in error path
authorChristian König <christian.koenig@amd.com>
Thu, 5 Jan 2023 10:27:16 +0000 (11:27 +0100)
committerChristian König <christian.koenig@amd.com>
Thu, 5 Jan 2023 19:34:58 +0000 (20:34 +0100)
When the fence can't be added we need to drop the reference.

Suggested-by: Bert Karwatzki <spasswolf@web.de>
Signed-off-by: Christian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230105111703.52695-2-christian.koenig@amd.com
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Luben Tuikov <luben.tuikov@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c

index bac7976..dcd8c06 100644 (file)
@@ -391,8 +391,10 @@ int amdgpu_sync_push_to_job(struct amdgpu_sync *sync, struct amdgpu_job *job)
 
                dma_fence_get(f);
                r = drm_sched_job_add_dependency(&job->base, f);
-               if (r)
+               if (r) {
+                       dma_fence_put(f);
                        return r;
+               }
        }
        return 0;
 }