[Mesa-dev] [PATCH 2/2] disk_cache: remove unnecessary NULL-pointer guards

Marek Olšák maraeo at gmail.com
Fri Oct 6 22:25:11 UTC 2017


Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Marek

On Fri, Oct 6, 2017 at 10:21 PM, Nicolai Hähnle <nhaehnle at gmail.com> wrote:
> From: Nicolai Hähnle <nicolai.haehnle at amd.com>
>
> ---
>  src/util/disk_cache.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c
> index 63fd8e1f93a..e38cacb259b 100644
> --- a/src/util/disk_cache.c
> +++ b/src/util/disk_cache.c
> @@ -980,24 +980,22 @@ cache_put(void *job, int thread_index)
>     p_atomic_add(dc_job->cache->size, sb.st_blocks * 512);
>
>   done:
>     if (fd_final != -1)
>        close(fd_final);
>     /* This close finally releases the flock, (now that the final file
>      * has been renamed into place and the size has been added).
>      */
>     if (fd != -1)
>        close(fd);
> -   if (filename_tmp)
> -      free(filename_tmp);
> -   if (filename)
> -      free(filename);
> +   free(filename_tmp);
> +   free(filename);
>  }
>
>  void
>  disk_cache_put(struct disk_cache *cache, const cache_key key,
>                 const void *data, size_t size,
>                 struct cache_item_metadata *cache_item_metadata)
>  {
>     struct disk_cache_put_job *dc_job =
>        create_put_job(cache, key, data, size, cache_item_metadata);
>
> --
> 2.11.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list