[PATCH 1/2] drm/sched: don't try to construct error code from NULL ptr

Lucas Stach l.stach at pengutronix.de
Fri Nov 29 13:26:42 UTC 2019


If the job submission fails with a NULL fence returned instead of an
error pointer we must not try to convert this into an error. The error
code in this case will be 0, which causes a warning splat from
dma_fence_set_error().

Also most drivers return NULL from the run_job callback if the fence
already has the error state set, so trying to set a 0 error code
actively destroys the valid error code on the fence.

Fixes: 167bf96014a0 (drm/sched: Set error to s_fence if HW job
       submission failed.)
Signed-off-by: Lucas Stach <l.stach at pengutronix.de>
---
 drivers/gpu/drm/scheduler/sched_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c
index f39b97ed4ade..596a28d90e5c 100644
--- a/drivers/gpu/drm/scheduler/sched_main.c
+++ b/drivers/gpu/drm/scheduler/sched_main.c
@@ -495,7 +495,7 @@ void drm_sched_resubmit_jobs(struct drm_gpu_scheduler *sched)
 		dma_fence_put(s_job->s_fence->parent);
 		fence = sched->ops->run_job(s_job);
 
-		if (IS_ERR_OR_NULL(fence)) {
+		if (IS_ERR(fence)) {
 			s_job->s_fence->parent = NULL;
 			dma_fence_set_error(&s_fence->finished, PTR_ERR(fence));
 		} else {
-- 
2.20.1



More information about the dri-devel mailing list