[<prev] [next>] [day] [month] [year] [list]
Message-ID: <167638827427.6570.12643671133126504826.stgit@bazille.1015granger.net>
Date: Tue, 14 Feb 2023 10:24:34 -0500
From: Chuck Lever <cel@...nel.org>
To: colin.i.king@...il.com, error27@...il.com
Cc: jlayton@...hat.com, linux-nfs@...r.kernel.org,
kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] NFSD: Clean up nfsd_symlink()
From: Chuck Lever <chuck.lever@...cle.com>
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);
No need to initialize "int ret = -ENOMEM;" either.
These are vestiges of nfsd_mkdir(), from whence I copied
nfsd_symlink().
Reported-by: Colin Ian King <colin.i.king@...il.com>
Reported-by: Dan Carpenter <error27@...il.com>
Signed-off-by: Chuck Lever <chuck.lever@...cle.com>
---
fs/nfsd/nfsctl.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index 04474b8ccf0a..7b8f17ee5224 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -1214,22 +1214,17 @@ static void nfsd_symlink(struct dentry *parent, const char *name,
{
struct inode *dir = parent->d_inode;
struct dentry *dentry;
- int ret = -ENOMEM;
+ int ret;
inode_lock(dir);
dentry = d_alloc_name(parent, name);
if (!dentry)
- goto out_err;
+ goto out;
ret = __nfsd_symlink(d_inode(parent), dentry, S_IFLNK | 0777, content);
if (ret)
- goto out_err;
+ dput(dentry);
out:
inode_unlock(dir);
- return;
-out_err:
- dput(dentry);
- dentry = ERR_PTR(ret);
- goto out;
}
#else
static inline void nfsd_symlink(struct dentry *parent, const char *name,
Powered by blists - more mailing lists