On 7/3/26 6:55 AM, [email protected] wrote:
> From: Mohammad Shahid <[email protected]>
> 
> vfree() safely handles NULL pointers, so the explicit NULL check
> before calling vfree() is unnecessary.
> 
> This issue was reported by ifnullfree.cocci.
> 
> Signed-off-by: Mohammad Shahid <[email protected]>

Reviewed-by: Dave Jiang <[email protected]>

> ---
>  tools/testing/nvdimm/test/ndtest.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/tools/testing/nvdimm/test/ndtest.c 
> b/tools/testing/nvdimm/test/ndtest.c
> index 8e3b6be53839..2051ad5d4882 100644
> --- a/tools/testing/nvdimm/test/ndtest.c
> +++ b/tools/testing/nvdimm/test/ndtest.c
> @@ -376,8 +376,7 @@ static void *ndtest_alloc_resource(struct ndtest_priv *p, 
> size_t size,
>  buf_err:
>       if (__dma && size >= DIMM_SIZE)
>               gen_pool_free(ndtest_pool, __dma, size);
> -     if (buf)
> -             vfree(buf);
> +     vfree(buf);
>       kfree(res);
>  
>       return NULL;


Reply via email to