]> git.baikalelectronics.ru Git - kernel.git/commit
afs: Remove redundant assignment to ret
authorJiapeng Chong <jiapeng.chong@linux.alibaba.com>
Thu, 29 Apr 2021 10:18:12 +0000 (18:18 +0800)
committerDavid Howells <dhowells@redhat.com>
Wed, 21 Jul 2021 14:11:22 +0000 (15:11 +0100)
commita738b989fad883c83b4c5b31eb1d6ec21fc2f25d
treef502d681ec66a0c6bf3c83b1a4fb3c7d5e9f7026
parent9f0b9003526f4a49f4f4b41906d46c5b0fb21b08
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: 590fdde7416c ("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/
Link: https://lore.kernel.org/r/162610729052.3408253.17364333638838151299.stgit@warthog.procyon.org.uk/
fs/afs/dir.c