Is there any cleanup we can simultaneously? (Where the check was done
outside?) Or is this a futureproofing?

On Fri, Aug 02, 2019 at 12:12:56PM +0200, Boris Brezillon wrote:
> Allows us to pass BOs without checking if they're NULL or not.
> 
> Signed-off-by: Boris Brezillon <boris.brezil...@collabora.com>
> ---
>  src/gallium/drivers/panfrost/pan_resource.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/src/gallium/drivers/panfrost/pan_resource.c 
> b/src/gallium/drivers/panfrost/pan_resource.c
> index 71da383d4c7a..f74a39555b45 100644
> --- a/src/gallium/drivers/panfrost/pan_resource.c
> +++ b/src/gallium/drivers/panfrost/pan_resource.c
> @@ -443,12 +443,16 @@ panfrost_resource_create(struct pipe_screen *screen,
>  void
>  panfrost_bo_reference(struct panfrost_bo *bo)
>  {
> -        pipe_reference(NULL, &bo->reference);
> +        if (bo)
> +                pipe_reference(NULL, &bo->reference);
>  }
>  
>  void
>  panfrost_bo_unreference(struct pipe_screen *screen, struct panfrost_bo *bo)
>  {
> +        if (!bo)
> +                return;
> +
>          /* When the reference count goes to zero, we need to cleanup */
>  
>          if (pipe_reference(&bo->reference, NULL))
> -- 
> 2.21.0
> 

Attachment: signature.asc
Description: PGP signature

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to