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

Alyssa Rosenzweig alyssa.rosenzweig at collabora.com
Tue Aug 13 23:48:35 UTC 2019


Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>

On Tue, Aug 13, 2019 at 08:35:21PM +0200, Boris Brezillon wrote:
> 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
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20190813/0c6617c2/attachment.sig>


More information about the mesa-dev mailing list