]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
btrfs: simplify add_extent_mapping() by removing pointless label
authorFilipe Manana <fdmanana@suse.com>
Tue, 16 Jan 2024 16:00:16 +0000 (16:00 +0000)
committerDavid Sterba <dsterba@suse.com>
Tue, 7 May 2024 19:31:04 +0000 (21:31 +0200)
The add_extent_mapping() function is short and trivial, there's no need to
have a label for a quick exit in case of an error, even because there's no
error handling needed, we just need to return the error. So remove that
label and return directly.

Also while at it remove the redundant initialization of 'ret', as that may
help avoid some warnings with clang tools such as the one reported/fixed
by commit 966de47ff0c9 ("btrfs: remove redundant initialization of
variables in log_new_ancestors").

Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent_map.c

index ac4361792ffc9a0110d97e43d8cd7082140b2380..4a9fbcb24d9b3ecda3cc6d249a38cb5e7df95029 100644 (file)
@@ -370,17 +370,17 @@ static inline void setup_extent_mapping(struct extent_map_tree *tree,
 static int add_extent_mapping(struct extent_map_tree *tree,
                              struct extent_map *em, int modified)
 {
-       int ret = 0;
+       int ret;
 
        lockdep_assert_held_write(&tree->lock);
 
        ret = tree_insert(&tree->map, em);
        if (ret)
-               goto out;
+               return ret;
 
        setup_extent_mapping(tree, em, modified);
-out:
-       return ret;
+
+       return 0;
 }
 
 static struct extent_map *