drm/amdgpu: If amdgpu_ib_schedule fails return back the error.
authorAndrey Grodzovsky <andrey.grodzovsky@amd.com>
Thu, 24 Oct 2019 19:44:10 +0000 (15:44 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 30 Oct 2019 15:56:15 +0000 (11:56 -0400)
Use ERR_PTR to return back the error happened during amdgpu_ib_schedule.

Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c

index 9d76e0923a5a3a4d705a0905b63036344b3f3bd7..96b2a31ccfed357956cd347bc0c1b0723d4e9c53 100644 (file)
@@ -218,7 +218,7 @@ static struct dma_fence *amdgpu_job_run(struct drm_sched_job *sched_job)
        struct amdgpu_ring *ring = to_amdgpu_ring(sched_job->sched);
        struct dma_fence *fence = NULL, *finished;
        struct amdgpu_job *job;
-       int r;
+       int r = 0;
 
        job = to_amdgpu_job(sched_job);
        finished = &job->base.s_fence->finished;
@@ -243,6 +243,8 @@ static struct dma_fence *amdgpu_job_run(struct drm_sched_job *sched_job)
        job->fence = dma_fence_get(fence);
 
        amdgpu_job_free_resources(job);
+
+       fence = r ? ERR_PTR(r) : fence;
        return fence;
 }