Commit 4b471a8b authored by Chuck Lever's avatar Chuck Lever

NFSD: Clean up nfsd_symlink()

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: default avatarColin Ian King <colin.i.king@gmail.com>
Reported-by: default avatarDan Carpenter <error27@gmail.com>
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
parent 90d21755
...@@ -1214,22 +1214,17 @@ static void nfsd_symlink(struct dentry *parent, const char *name, ...@@ -1214,22 +1214,17 @@ static void nfsd_symlink(struct dentry *parent, const char *name,
{ {
struct inode *dir = parent->d_inode; struct inode *dir = parent->d_inode;
struct dentry *dentry; struct dentry *dentry;
int ret = -ENOMEM; int ret;
inode_lock(dir); inode_lock(dir);
dentry = d_alloc_name(parent, name); dentry = d_alloc_name(parent, name);
if (!dentry) if (!dentry)
goto out_err; goto out;
ret = __nfsd_symlink(d_inode(parent), dentry, S_IFLNK | 0777, content); ret = __nfsd_symlink(d_inode(parent), dentry, S_IFLNK | 0777, content);
if (ret) if (ret)
goto out_err; dput(dentry);
out: out:
inode_unlock(dir); inode_unlock(dir);
return;
out_err:
dput(dentry);
dentry = ERR_PTR(ret);
goto out;
} }
#else #else
static inline void nfsd_symlink(struct dentry *parent, const char *name, static inline void nfsd_symlink(struct dentry *parent, const char *name,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment