[PATCH] drm/amdgpu: add missing NULL check in amdgpu_vm_update_mapping

Christian König ckoenig.leichtzumerken at gmail.com
Thu Mar 24 08:13:37 UTC 2022


The fence parameter is only optional.

Signed-off-by: Christian König <christian.koenig at amd.com>
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;
 	}
 
-- 
2.25.1



More information about the amd-gfx mailing list