2019-09-03 06:08:23

by zhong jiang

[permalink] [raw]
Subject: [PATCH] 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.

Signed-off-by: zhong jiang <[email protected]>
---
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);
}

--
1.7.12.4


2019-09-04 15:13:36

by Markus Elfring

[permalink] [raw]
Subject: Re: NFS: remove the redundant check when kfree an object in nfs_netns_client_release

> 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

2019-09-05 02:41:32

by zhong jiang

[permalink] [raw]
Subject: Re: NFS: remove the redundant check when kfree an object in nfs_netns_client_release

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


2019-09-05 10:06:08

by Markus Elfring

[permalink] [raw]
Subject: Re: NFS: Checking the handling of patch variations

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