afs: Remove redundant assignment to ret
Variable ret is set to -ENOENT and -ENOMEM but this value is never
read as it is overwritten or not used later on, hence it is a
redundant assignment and can be removed.
Cleans up the following clang-analyzer warning:
fs/afs/dir.c:2014:4: warning: Value stored to 'ret' is never read
[clang-analyzer-deadcode.DeadStores].
fs/afs/dir.c:659:2: warning: Value stored to 'ret' is never read
[clang-analyzer-deadcode.DeadStores].
[DH made the following modifications:
- In afs_rename(), -ENOMEM should be placed in op->error instead of ret,
rather than the assignment being removed entirely. afs_put_operation()
will pick it up from there and return it.
- If afs_sillyrename() fails, its error code should be placed in op->error
rather than in ret also.
]
Fixes: e49c7b2f6d
("afs: Build an abstraction around an "operation" concept")
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
Link: https://lore.kernel.org/r/1619691492-83866-1-git-send-email-jiapeng.chong@linux.alibaba.com
Link: https://lore.kernel.org/r/162609465444.3133237.7562832521724298900.stgit@warthog.procyon.org.uk/ # v1
Link: https://lore.kernel.org/r/162610729052.3408253.17364333638838151299.stgit@warthog.procyon.org.uk/ # v2
This commit is contained in:
parent
5a972474cf
commit
b428081282
10
fs/afs/dir.c
10
fs/afs/dir.c
@ -656,7 +656,6 @@ static int afs_do_lookup_one(struct inode *dir, struct dentry *dentry,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = -ENOENT;
|
|
||||||
if (!cookie.found) {
|
if (!cookie.found) {
|
||||||
_leave(" = -ENOENT [not found]");
|
_leave(" = -ENOENT [not found]");
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
@ -2020,17 +2019,20 @@ static int afs_rename(struct user_namespace *mnt_userns, struct inode *old_dir,
|
|||||||
|
|
||||||
if (d_count(new_dentry) > 2) {
|
if (d_count(new_dentry) > 2) {
|
||||||
/* copy the target dentry's name */
|
/* copy the target dentry's name */
|
||||||
ret = -ENOMEM;
|
|
||||||
op->rename.tmp = d_alloc(new_dentry->d_parent,
|
op->rename.tmp = d_alloc(new_dentry->d_parent,
|
||||||
&new_dentry->d_name);
|
&new_dentry->d_name);
|
||||||
if (!op->rename.tmp)
|
if (!op->rename.tmp) {
|
||||||
|
op->error = -ENOMEM;
|
||||||
goto error;
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
ret = afs_sillyrename(new_dvnode,
|
ret = afs_sillyrename(new_dvnode,
|
||||||
AFS_FS_I(d_inode(new_dentry)),
|
AFS_FS_I(d_inode(new_dentry)),
|
||||||
new_dentry, op->key);
|
new_dentry, op->key);
|
||||||
if (ret)
|
if (ret) {
|
||||||
|
op->error = ret;
|
||||||
goto error;
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
op->dentry_2 = op->rename.tmp;
|
op->dentry_2 = op->rename.tmp;
|
||||||
op->rename.rehash = NULL;
|
op->rename.rehash = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user