drm/sched: Fix passing zero to 'PTR_ERR' warning v2 46/239246/1
authorAndrey Grodzovsky <andrey.grodzovsky@amd.com>
Tue, 29 Oct 2019 15:03:05 +0000 (11:03 -0400)
committerHoegeun Kwon <hoegeun.kwon@samsung.com>
Thu, 23 Jul 2020 05:43:46 +0000 (14:43 +0900)
Fix a static code checker warning.

v2: Drop PTR_ERR_OR_ZERO.

Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Reviewed-by: Emily Deng <Emily.Deng@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
[hoegeun.kwon: backport mainline commit d7c5782acd35 drm/sched:  Fix passing zero to 'PTR_ERR' warning v2]
Change-Id: Idf3993133edb062275df2378ea69b2002667893e
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
drivers/gpu/drm/scheduler/sched_main.c

index dfb29e6..30c5ddd 100644 (file)
@@ -496,8 +496,10 @@ void drm_sched_resubmit_jobs(struct drm_gpu_scheduler *sched)
                fence = sched->ops->run_job(s_job);
 
                if (IS_ERR_OR_NULL(fence)) {
+                       if (IS_ERR(fence))
+                               dma_fence_set_error(&s_fence->finished, PTR_ERR(fence));
+
                        s_job->s_fence->parent = NULL;
-                       dma_fence_set_error(&s_fence->finished, PTR_ERR(fence));
                } else {
                        s_job->s_fence->parent = fence;
                }
@@ -748,8 +750,9 @@ static int drm_sched_main(void *param)
                                          r);
                        dma_fence_put(fence);
                } else {
+                       if (IS_ERR(fence))
+                               dma_fence_set_error(&s_fence->finished, PTR_ERR(fence));
 
-                       dma_fence_set_error(&s_fence->finished, PTR_ERR(fence));
                        drm_sched_process_job(NULL, &sched_job->cb);
                }