drm/amdgpu: adjust the judgement of removing fence callback
authorJunwei Zhang <Jerry.Zhang@amd.com>
Wed, 26 Aug 2015 01:34:59 +0000 (09:34 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 26 Aug 2015 21:50:04 +0000 (17:50 -0400)
The fence in the array may be skipped if wait_all is false,
thus the related callback is not initialized with list head.
So removing this kind callback will cause NULL pointer reference.

Signed-off-by: Junwei Zhang <Jerry.Zhang@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c

index 9787337a65a105662c0419b0f0d1e0168f43db6e..f446bf2fedc99266576e2a9b0bc81cd141048435 100644 (file)
@@ -966,7 +966,7 @@ signed long amdgpu_fence_wait_multiple(struct amdgpu_device *adev,
 fence_rm_cb:
        for (idx = 0; idx < count; ++idx) {
                fence = array[idx];
-               if (fence)
+               if (fence && cb[idx].base.func)
                        fence_remove_callback(fence, &cb[idx].base);
        }