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

Message ID 1567490688-17872-1-git-send-email-zhongjiang@huawei.com
State New
Headers show
Series
  • NFS: remove the redundant check when kfree an object in nfs_netns_client_release
Related show

Commit Message

zhong jiang Sept. 3, 2019, 6:04 a.m. UTC
kfree has taken the null check in account. hence it is unnecessary to add the
null check before kfree the object. Just remove it.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
 fs/nfs/sysfs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Markus Elfring Sept. 4, 2019, 3:11 p.m. UTC | #1
> kfree has taken the null check in account.

I suggest to take another look at a similar patch.

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
zhong jiang Sept. 5, 2019, 2:40 a.m. UTC | #2
On 2019/9/4 23:11, Markus Elfring wrote:
>> 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
> 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
>
> .
>
Markus Elfring Sept. 5, 2019, 9 a.m. UTC | #3
>> 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

Patch
diff mbox series

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);
 }