If we don't end up using the vm fence, we never initialize it
so it never gets freed.  Free it in that case.

Fixes: db36632ea51e ("drm/amdgpu: clean up and unify hw fence handling")
Signed-off-by: Alex Deucher <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index db66b4232de02..f3373d5f429f8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -845,6 +845,9 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring, struct 
amdgpu_job *job,
                if (r)
                        return r;
                fence = &job->hw_vm_fence->base;
+       } else {
+               /* free the vm fence if we are not using it */
+               kfree(job->hw_vm_fence);
        }
 
        if (vm_flush_needed) {
-- 
2.51.0

Reply via email to