drm/amdgpu: fix NULL fence handling in amdgpu_cs_fence_to_handle_ioctl
authorChristian König <christian.koenig@amd.com>
Mon, 3 Dec 2018 13:05:34 +0000 (14:05 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 14 Dec 2018 20:54:11 +0000 (15:54 -0500)
When the fence is already signaled it is perfectly normal to get a NULL
fence here. But since we can't export that we need to use a stub fence.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c

index 5dc3ee372e2f9959e945e56324621dc894222667..149b3065119b6939105fc05203fb552990e3a55e 100644 (file)
@@ -1428,6 +1428,9 @@ int amdgpu_cs_fence_to_handle_ioctl(struct drm_device *dev, void *data,
        if (IS_ERR(fence))
                return PTR_ERR(fence);
 
+       if (!fence)
+               fence = dma_fence_get_stub();
+
        switch (info->in.what) {
        case AMDGPU_FENCE_TO_HANDLE_GET_SYNCOBJ:
                r = drm_syncobj_create(&syncobj, 0, fence);