2021-06-05 12:21:35

by 赵军奎

[permalink] [raw]
Subject: [PATCH] drm/etnaviv: remove NULL check which is not needed

NULL check before kvfree functions is not needed.

Signed-off-by: Bernard Zhao <[email protected]>
---
drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c
index b390dd4d60b7..d741b1d735f7 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c
@@ -80,8 +80,7 @@ static void etnaviv_gem_prime_release(struct etnaviv_gem_object *etnaviv_obj)
/* Don't drop the pages for imported dmabuf, as they are not
* ours, just free the array we allocated:
*/
- if (etnaviv_obj->pages)
- kvfree(etnaviv_obj->pages);
+ kvfree(etnaviv_obj->pages);

drm_prime_gem_destroy(&etnaviv_obj->base, etnaviv_obj->sgt);
}
--
2.31.0


2021-06-07 07:01:07

by Christian Gmeiner

[permalink] [raw]
Subject: Re: [PATCH] drm/etnaviv: remove NULL check which is not needed

Am Sa., 5. Juni 2021 um 14:18 Uhr schrieb Bernard Zhao <[email protected]>:
>
> NULL check before kvfree functions is not needed.
>
> Signed-off-by: Bernard Zhao <[email protected]>
> ---
> drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c
> index b390dd4d60b7..d741b1d735f7 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c
> @@ -80,8 +80,7 @@ static void etnaviv_gem_prime_release(struct etnaviv_gem_object *etnaviv_obj)
> /* Don't drop the pages for imported dmabuf, as they are not
> * ours, just free the array we allocated:
> */
> - if (etnaviv_obj->pages)
> - kvfree(etnaviv_obj->pages);
> + kvfree(etnaviv_obj->pages);
>
> drm_prime_gem_destroy(&etnaviv_obj->base, etnaviv_obj->sgt);
> }
> --
> 2.31.0
>

Thanks for the patch, but there is an other one queued up in
etnaviv/next that fixes the same issue:
https://git.pengutronix.de/cgit/lst/linux/commit/?h=etnaviv/next&id=7d614ab2f20503ed8766363d41f8607337571adf

--
greets
--
Christian Gmeiner, MSc

https://christian-gmeiner.info/privacypolicy