btrfs: Turn an 'else if' into an 'else' in btrfs_uuid_tree_add
authorNathan Chancellor <natechancellor@gmail.com>
Thu, 7 Mar 2019 16:35:15 +0000 (09:35 -0700)
committerDavid Sterba <dsterba@suse.com>
Mon, 29 Apr 2019 17:02:19 +0000 (19:02 +0200)
When building with -Wsometimes-uninitialized, Clang warns:

fs/btrfs/uuid-tree.c:129:13: warning: variable 'eb' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
fs/btrfs/uuid-tree.c:129:13: warning: variable 'offset' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]

Clang can't tell that all cases are covered with this final else if.
Just turn it into an else so that it is clear.

Link: https://github.com/ClangBuiltLinux/linux/issues/385
Suggested-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/uuid-tree.c

index 3b2ae342e6498863ece42e848b1548c60a0682a5..c1cc9a5c002400930ab5f60c5b05da6f225e916c 100644 (file)
@@ -126,7 +126,7 @@ int btrfs_uuid_tree_add(struct btrfs_trans_handle *trans, u8 *uuid, u8 type,
                slot = path->slots[0];
                offset = btrfs_item_ptr_offset(eb, slot);
                offset += btrfs_item_size_nr(eb, slot) - sizeof(subid_le);
-       } else if (ret < 0) {
+       } else {
                btrfs_warn(fs_info,
                           "insert uuid item failed %d (0x%016llx, 0x%016llx) type %u!",
                           ret, (unsigned long long)key.objectid,