Re: [PATCH] nvdimm: nfit: remove redundant NULL check before vfree()
Dave Jiang <[email protected]>
| Newsgroups | dev.linux.lists.nvdimm,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
On 7/3/26 7:48 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/nfit.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/tools/testing/nvdimm/test/nfit.c b/tools/testing/nvdimm/test/nfit.c > index f87e9f251d13..009fe107b0d7 100644 > --- a/tools/testing/nvdimm/test/nfit.c > +++ b/tools/testing/nvdimm/test/nfit.c > @@ -1644,8 +1644,7 @@ 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; > }