2023-02-14 14:15:50

by Colin Ian King

[permalink] [raw]
Subject: [PATCH][next] nfsd: remove redundant assignment to pointer dentry

The pointer dentry is assigned a value that is never read, the
assignment is redundant and can be removed.

Cleans up clang-scan warning:
fs/nfsd/nfsctl.c:1231:2: warning: Value stored to 'dentry' is
never read [deadcode.DeadStores]
dentry = ERR_PTR(ret);

Signed-off-by: Colin Ian King <[email protected]>
---
fs/nfsd/nfsctl.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index 04474b8ccf0a..5946064cd794 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -1228,7 +1228,6 @@ static void nfsd_symlink(struct dentry *parent, const char *name,
return;
out_err:
dput(dentry);
- dentry = ERR_PTR(ret);
goto out;
}
#else
--
2.30.2



2023-02-14 14:55:45

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH][next] nfsd: remove redundant assignment to pointer dentry

On Tue, Feb 14, 2023 at 02:14:28PM +0000, Colin Ian King wrote:
> The pointer dentry is assigned a value that is never read, the
> assignment is redundant and can be removed.
>
> Cleans up clang-scan warning:
> fs/nfsd/nfsctl.c:1231:2: warning: Value stored to 'dentry' is
> never read [deadcode.DeadStores]
> dentry = ERR_PTR(ret);
>
> Signed-off-by: Colin Ian King <[email protected]>

No need to initalized "int ret = -ENOMEM;" either.

regards,
dan carpenter


2023-02-14 15:16:20

by Chuck Lever III

[permalink] [raw]
Subject: Re: [PATCH][next] nfsd: remove redundant assignment to pointer dentry



> On Feb 14, 2023, at 9:55 AM, Dan Carpenter <[email protected]> wrote:
>
> On Tue, Feb 14, 2023 at 02:14:28PM +0000, Colin Ian King wrote:
>> The pointer dentry is assigned a value that is never read, the
>> assignment is redundant and can be removed.
>>
>> Cleans up clang-scan warning:
>> fs/nfsd/nfsctl.c:1231:2: warning: Value stored to 'dentry' is
>> never read [deadcode.DeadStores]
>> dentry = ERR_PTR(ret);
>>
>> Signed-off-by: Colin Ian King <[email protected]>
>
> No need to initalized "int ret = -ENOMEM;" either.

Thanks for the report.

Both came in when I copied nfsd_mkdir. I'll clean them up.


--
Chuck Lever