<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <p>Reviewed-By: Philip Yang<a class="moz-txt-link-rfc2396E" href="mailto:Philip.Yang@amd.com"><Philip.Yang@amd.com></a><br>
    </p>
    <div class="moz-cite-prefix">On 2022-03-24 4:13 a.m., Christian
      König wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:20220324081337.2064-1-christian.koenig@amd.com">
      <pre class="moz-quote-pre" wrap="">The fence parameter is only optional.

Signed-off-by: Christian König <a class="moz-txt-link-rfc2396E" href="mailto:christian.koenig@amd.com"><christian.koenig@amd.com></a>
Fixes: 86fd5edfbdae ("drm/amdgpu: rework TLB flushing")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index c29b12fec863..48f326609976 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -929,9 +929,10 @@ int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,
 
        if (!unlocked && (!(flags & AMDGPU_PTE_VALID) || params.table_freed)) {
                tlb_cb->vm = vm;
-               if (!*fence || dma_fence_add_callback(*fence, &tlb_cb->cb,
-                                                     amdgpu_vm_tlb_seq_cb))
-                       amdgpu_vm_tlb_seq_cb(*fence, &tlb_cb->cb);
+               if (!fence || !*fence ||
+                   dma_fence_add_callback(*fence, &tlb_cb->cb,
+                                          amdgpu_vm_tlb_seq_cb))
+                       amdgpu_vm_tlb_seq_cb(NULL, &tlb_cb->cb);
                tlb_cb = NULL;
        }
 
</pre>
    </blockquote>
  </body>
</html>