[bug report] drm/sched: Set error to s_fence if HW job submission failed.

Dan Carpenter dan.carpenter at oracle.com
Tue Oct 29 14:39:14 UTC 2019


Hello Andrey Grodzovsky,

The patch e91e5f080e03: "drm/sched: Set error to s_fence if HW job
submission failed." from Oct 24, 2019, leads to the following static
checker warning:

	drivers/gpu/drm/scheduler/sched_main.c:500 drm_sched_resubmit_jobs()
	warn: passing zero to 'PTR_ERR'

drivers/gpu/drm/scheduler/sched_main.c
   477  void drm_sched_resubmit_jobs(struct drm_gpu_scheduler *sched)
   478  {
   479          struct drm_sched_job *s_job, *tmp;
   480          uint64_t guilty_context;
   481          bool found_guilty = false;
   482          struct dma_fence *fence;
   483  
   484          list_for_each_entry_safe(s_job, tmp, &sched->ring_mirror_list, node) {
   485                  struct drm_sched_fence *s_fence = s_job->s_fence;
   486  
   487                  if (!found_guilty && atomic_read(&s_job->karma) > sched->hang_limit) {
   488                          found_guilty = true;
   489                          guilty_context = s_job->s_fence->scheduled.context;
   490                  }
   491  
   492                  if (found_guilty && s_job->s_fence->scheduled.context == guilty_context)
   493                          dma_fence_set_error(&s_fence->finished, -ECANCELED);
   494  
   495                  dma_fence_put(s_job->s_fence->parent);
   496                  fence = sched->ops->run_job(s_job);
   497  
   498                  if (IS_ERR_OR_NULL(fence)) {
                            ^^^^^^^^^^^^^^^^^^^^

   499                          s_job->s_fence->parent = NULL;
   500                          dma_fence_set_error(&s_fence->finished, PTR_ERR(fence));
                                                                        ^^^^^^^^^^^^^^
If "fence" is NULL then it triggers a WARN_ON() inside the
dma_fence_set_error() function.

	WARN_ON(error >= 0 || error < -MAX_ERRNO);
                ^^^^^^^^^^

   501                  } else {
   502                          s_job->s_fence->parent = fence;
   503                  }
   504  
   505  
   506          }
   507  }

regards,
dan carpenter


More information about the dri-devel mailing list