[Mesa-dev] [PATCH] panfrost: Kill a useless NULL test in panfrost_job_submit()

Boris Brezillon boris.brezillon at collabora.com
Tue Aug 13 18:35:21 UTC 2019


The !job test is done after dereferencing the job pointer, which means
it's either always false or we have a NULL pointer exception.

Replace that test by an assert() at the beginning of the function.

Signed-off-by: Boris Brezillon <boris.brezillon at collabora.com>
---
 src/gallium/drivers/panfrost/pan_job.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_job.c b/src/gallium/drivers/panfrost/pan_job.c
index 661f8ae154e2..c2c3aa30714d 100644
--- a/src/gallium/drivers/panfrost/pan_job.c
+++ b/src/gallium/drivers/panfrost/pan_job.c
@@ -204,14 +204,12 @@ panfrost_job_submit(struct panfrost_context *ctx, struct panfrost_job *job)
 {
         int ret;
 
+        assert(job);
         panfrost_scoreboard_link_batch(job);
 
         bool has_draws = job->last_job.gpu;
         bool is_scanout = panfrost_is_scanout(ctx);
 
-        if (!job)
-                return;
-
         ret = panfrost_drm_submit_vs_fs_job(ctx, has_draws, is_scanout);
 
         if (ret)
-- 
2.21.0



More information about the mesa-dev mailing list