linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nfs: No need to add NULL check before function kfree()
@ 2019-10-15 12:25 chenxiang
  0 siblings, 0 replies; only message in thread
From: chenxiang @ 2019-10-15 12:25 UTC (permalink / raw)
  To: trond.myklebust, anna.schumaker
  Cc: linux-nfs, linux-fsdevel, linuxarm, Xiang Chen

From: Xiang Chen <chenxiang66@hisilicon.com>

It fixes the warning as follows reported by coccicheck:
fs/nfs/sysfs.c:125:2-7: WARNING: NULL check before some freeing functions is not
needed.

Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
---
 fs/nfs/sysfs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/nfs/sysfs.c b/fs/nfs/sysfs.c
index 4f3390b..c489496 100644
--- a/fs/nfs/sysfs.c
+++ b/fs/nfs/sysfs.c
@@ -121,8 +121,7 @@ static void nfs_netns_client_release(struct kobject *kobj)
 			struct nfs_netns_client,
 			kobject);
 
-	if (c->identifier)
-		kfree(c->identifier);
+	kfree(c->identifier);
 	kfree(c);
 }
 
-- 
2.8.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-10-15 12:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-15 12:25 [PATCH] nfs: No need to add NULL check before function kfree() chenxiang

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).