Skip to contentSkip to conversation

NFS: remove the redundant check when kfree an object in nfs_netns_client_release

PATCH In review zhong jiang 2 participants 4 messages Sep 3, 2019 – Sep 5, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 NFS: remove the redundant check when kfree an object in nfs_netns_client_release

kfree has taken the null check in account. hence it is unnecessary to add the null check before kfree the object. Just remove it.

---
 fs/nfs/sysfs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
fs/nfs/sysfs.c +1 -2
index 4f3390b..c489496 100644
@@ -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);
 }
 
Signature · 1 line
1.7.12.4
#2 lore raw
Quoted 2 lines · Markus Elfring
Quoted 1 line

kfree has taken the null check in account.

I suggest to take another look at a similar patch.

How to fast find out the similar patch. Search the key word doesn't work well.

Thanks,
zhong jiang

Quoted 10 lines

NFS: fix ifnullfree.cocci warnings
https://lkml.org/lkml/2019/7/7/73
https://lore.kernel.org/patchwork/patch/1098005/
https://lore.kernel.org/r/alpine.DEB.2.21.1907071844310.2521@hadrien/

Regards,
Markus

.

#3 lore raw

Re: NFS: Checking the handling of patch variations

Quoted 2 lines
Quoted 1 line

I suggest to take another look at a similar patch.

How to fast find out the similar patch. Search the key word doesn't work well.

This is a recurring development challenge, isn't it?

The occurrence of related update suggestions can occasionally become more interesting.

Regards,
Markus