btrfs: zoned: Remove redundant initialization of to_add
PATCH 1/1 btrfs: zoned: Remove redundant initialization of to_add
to_add is being initialized to len but this is never read as to_add is overwritten later on. Remove the redundant initialization.
Cleans up the following clang-analyzer warning:
fs/btrfs/extent-tree.c:2769:8: warning: Value stored to 'to_add' during its initialization is never read [clang-analyzer-deadcode.DeadStores].
--- fs/btrfs/extent-tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/extent-tree.c +1 -1
@@ -2766,7 +2766,7 @@ static int unpin_extent_range(struct btrfs_fs_info *fs_info,spin_unlock (&cache->lock);if (!readonly && return_free_space && global_rsv->space_info == space_info) { -u64 to_add = len; +u64 to_add;spin_lock (&global_rsv->lock);if (!global_rsv->full) {
Signature · 1 line
2.20.1.7.g153144c
Quoted 8 lines · Jiapeng Chong
to_addis being initialized to len but this is never read asto_addis overwritten later on. Remove the redundant initialization.Cleans up the following clang-analyzer warning:
fs/btrfs/extent-tree.c:2769:8: warning: Value stored to 'to_add' during its initialization is never read [clang-analyzer-deadcode.DeadStores].
To make it even better it would be good if to_add is define within the if (!global_rsv->full) branch.
Quoted 21 lines
Reported-by Abaci Robot <[email protected]>Signed-off-by Jiapeng Chong <[email protected]>--- fs/btrfs/extent-tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/btrfs/extent-tree.c +1
-1@@ -2766,7 +2766,7 @@ static int unpin_extent_range(struct btrfs_fs_info *fs_info,spin_unlock (&cache->lock);if (!readonly && return_free_space && global_rsv->space_info == space_info) { -u64 to_add = len; +u64 to_add;spin_lock (&global_rsv->lock);if (!global_rsv->full) {