NFSD: Remove redundant assignment to variable host_err
Subsystems (3)
PATCH 1/1 NFSD: Remove redundant assignment to variable host_err
Variable host_err is assigned a value that is never read, it is being re-assigned a value in every different execution path in the following switch statement. The assignment is redundant and can be removed.
Cleans up clang-scan warning:
warning: Value stored to 'host_err' is never read [deadcode.DeadStores]
--- fs/nfsd/vfs.c | 1 - 1 file changed, 1 deletion(-)
fs/nfsd/vfs.c +0 -1
@@ -1304,7 +1304,6 @@ nfsd_create_locked(struct svc_rqst *rqstp, struct svc_fh *fhp, iap->ia_mode &= ~current_umask (); err =0 ; - host_err =0 ;switch (type) {case S_IFREG : host_err =vfs_create (&init_user_ns, dirp, dchild, iap->ia_mode, true);
Signature · 1 line
2.37.3
Quoted 7 lines · Colin Ian King
Variable
host_erris assigned a value that is never read, it is being re-assigned a value in every different execution path in the following switch statement. The assignment is redundant and can be removed.Cleans up clang-scan warning:
warning: Value stored to 'host_err' is never read [deadcode.DeadStores]
The warning is a bit odd since it _is_ read at the bottom of the function:
err = nfserrno(host_err);
...but, all of the switch cases end up setting host_err, so the initialization isn't needed.
Quoted 10 lines
Signed-off-by Colin Ian King <[email protected]>--- fs/nfsd/vfs.c | 1 - 1 file changed, 1 deletion(-)fs/nfsd/vfs.c +0
-0
fs/nfsd/vfs.c nfsd_create_locked(struct svc_rqst *rqstp, struct svc_fh *fhp, · line 1309
Quoted 7 lines
fs/nfsd/vfs.c +0
-1@@ -1304,7 +1304,6 @@ nfsd_create_locked(struct svc_rqst *rqstp, struct svc_fh *fhp, iap->ia_mode &= ~current_umask (); err =0 ; - host_err =0 ;switch (type) {case S_IFREG : host_err =vfs_create (&init_user_ns, dirp, dchild, iap->ia_mode, true);
Quoted 12 lines · Colin Ian King
Variable
host_erris assigned a value that is never read, it is being re-assigned a value in every different execution path in the following switch statement. The assignment is redundant and can be removed.Cleans up clang-scan warning:
warning: Value stored to 'host_err' is never read [deadcode.DeadStores]Signed-off-by Colin Ian King <[email protected]>
Applying this for nfsd's for-next (not yet public). Thanks!
Quoted 19 lines
---
fs/nfsd/vfs.c| 1 -1 file changed, 1 deletion(-)fs/nfsd/vfs.c +0
-1@@ -1304,7 +1304,6 @@ nfsd_create_locked(struct svc_rqst *rqstp, struct svc_fh *fhp, iap->ia_mode &= ~current_umask (); err =0 ; - host_err =0 ;switch (type) {case S_IFREG : host_err =vfs_create (&init_user_ns, dirp, dchild, iap->ia_mode, true);Signature · 1 line
2.37.3
--
Chuck Lever