nvdimm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH] tools/testing/nvdimm: Remove NULL test before vfree
@ 2021-06-26  1:26 13145886936
  2021-06-26  1:40 ` Alison Schofield
  0 siblings, 1 reply; 2+ messages in thread
From: 13145886936 @ 2021-06-26  1:26 UTC (permalink / raw)
  To: dan.j.williams, vishal.l.verma, dave.jiang, ira.weiny
  Cc: nvdimm, linux-kernel, gushengxian

From: gushengxian <gushengxian@yulong.com>

This NULL test is redundant since vfree() checks for NULL.
Reported by Coccinelle.

Signed-off-by: gushengxian <gushengxian@yulong.com>
---
 tools/testing/nvdimm/test/nfit.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/nvdimm/test/nfit.c b/tools/testing/nvdimm/test/nfit.c
index 54f367cbadae..cb86f0cbb11c 100644
--- a/tools/testing/nvdimm/test/nfit.c
+++ b/tools/testing/nvdimm/test/nfit.c
@@ -1641,8 +1641,8 @@ static void *__test_alloc(struct nfit_test *t, size_t size, dma_addr_t *dma,
  err:
 	if (*dma && size >= DIMM_SIZE)
 		gen_pool_free(nfit_pool, *dma, size);
-	if (buf)
-		vfree(buf);
+
+	vfree(buf);
 	kfree(nfit_res);
 	return NULL;
 }
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] tools/testing/nvdimm: Remove NULL test before vfree
  2021-06-26  1:26 [PATCH] tools/testing/nvdimm: Remove NULL test before vfree 13145886936
@ 2021-06-26  1:40 ` Alison Schofield
  0 siblings, 0 replies; 2+ messages in thread
From: Alison Schofield @ 2021-06-26  1:40 UTC (permalink / raw)
  To: 13145886936
  Cc: dan.j.williams, vishal.l.verma, dave.jiang, ira.weiny, nvdimm,
	linux-kernel, gushengxian

On Fri, Jun 25, 2021 at 06:26:55PM -0700, 13145886936@163.com wrote:
> From: gushengxian <gushengxian@yulong.com>

Hi,

Thanks for updating the commit message and log.

I think you need to do something about the Signed-off-by or this
will not be accepted.  You can read more about the developer's
certificate of origin in here.
https://www.kernel.org/doc/html/latest/process/submitting-patches.html

Not sure your particular case, but maybe -

If you are submitting this on behalf of Gushengxian, then you need
to add your Signed-off-by after the current one:
ie. Signed-off-by: Your Full Name <13145886936@163.com>

Or, if this is your work, then you may need to update your
.gitconfig file, like this:

[user]
	name = Your Full Name
	email = email@example.com

The From line of the email needs to match a Signed-off-by.

Each time you repost a patch please increment the version number.
The next posting would be [PATCH v3]

Alison

> 
> This NULL test is redundant since vfree() checks for NULL.
> Reported by Coccinelle.
> 
> Signed-off-by: gushengxian <gushengxian@yulong.com>
> ---
>  tools/testing/nvdimm/test/nfit.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/nvdimm/test/nfit.c b/tools/testing/nvdimm/test/nfit.c
> index 54f367cbadae..cb86f0cbb11c 100644
> --- a/tools/testing/nvdimm/test/nfit.c
> +++ b/tools/testing/nvdimm/test/nfit.c
> @@ -1641,8 +1641,8 @@ static void *__test_alloc(struct nfit_test *t, size_t size, dma_addr_t *dma,
>   err:
>  	if (*dma && size >= DIMM_SIZE)
>  		gen_pool_free(nfit_pool, *dma, size);
> -	if (buf)
> -		vfree(buf);
> +
> +	vfree(buf);
>  	kfree(nfit_res);
>  	return NULL;
>  }
> -- 
> 2.25.1
> 
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-26  1:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-26  1:26 [PATCH] tools/testing/nvdimm: Remove NULL test before vfree 13145886936
2021-06-26  1:40 ` Alison Schofield

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).