panfrost: Kill a useless NULL test in panfrost_job_submit()

Submitted by Boris Brezillon on Aug. 13, 2019, 6:35 p.m.

Details

Message ID 20190813183521.2025-1-boris.brezillon@collabora.com
State Accepted
Commit a3c1ab2e9aae82b7b4e69679aefaefea2d9dc07f
Headers show
Series "panfrost: Kill a useless NULL test in panfrost_job_submit()" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Boris Brezillon Aug. 13, 2019, 6:35 p.m.
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@collabora.com>
---
 src/gallium/drivers/panfrost/pan_job.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Patch hide | download patch | download mbox

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)

Comments