diff options
author | Filipe Manana <fdmanana@suse.com> | 2025-04-10 14:59:05 +0300 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2025-05-15 15:30:50 +0300 |
commit | 5af1eae78d882efeaaa9a95e6ac7d70a8bf5fb9f (patch) | |
tree | 4a87938329be109d5f2bf9d98fc506bd24f77892 /fs/btrfs | |
parent | 2187540b6f4d92b4bf7622244dc2cbfa61ff1855 (diff) | |
download | linux-5af1eae78d882efeaaa9a95e6ac7d70a8bf5fb9f.tar.xz |
btrfs: add missing error return to btrfs_clear_extent_bit_changeset()
We have a couple error branches where we have an error stored in the 'err'
variable and then jump to the 'out' label, however we don't return that
error, we just return 0. Normally this is not a problem since those error
branches call extent_io_tree_panic() which triggers a BUG() call, however
it's possible to have rather exotic kernel config with CONFIG_BUG disabled
in which case the BUG() call does nothing and we fallthrough. So make sure
to return the error, not just to fix that exotic case but also to make the
code less confusing. While at it also rename the 'err' variable to 'ret'
since this is the style we prefer and use more widely.
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/extent-io-tree.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/fs/btrfs/extent-io-tree.c b/fs/btrfs/extent-io-tree.c index b868313e777e..3743ff777ada 100644 --- a/fs/btrfs/extent-io-tree.c +++ b/fs/btrfs/extent-io-tree.c @@ -604,7 +604,7 @@ int btrfs_clear_extent_bit_changeset(struct extent_io_tree *tree, u64 start, u64 struct extent_state *cached; struct extent_state *prealloc = NULL; u64 last_end; - int err; + int ret = 0; int clear = 0; int wake; int delete = (bits & EXTENT_CLEAR_ALL_BITS); @@ -690,10 +690,10 @@ hit_next: prealloc = alloc_extent_state_atomic(prealloc); if (!prealloc) goto search_again; - err = split_state(tree, state, prealloc, start); + ret = split_state(tree, state, prealloc, start); prealloc = NULL; - if (err) { - extent_io_tree_panic(tree, state, "split", err); + if (ret) { + extent_io_tree_panic(tree, state, "split", ret); goto out; } if (state->end <= end) { @@ -711,9 +711,9 @@ hit_next: prealloc = alloc_extent_state_atomic(prealloc); if (!prealloc) goto search_again; - err = split_state(tree, state, prealloc, end + 1); - if (err) { - extent_io_tree_panic(tree, state, "split", err); + ret = split_state(tree, state, prealloc, end + 1); + if (ret) { + extent_io_tree_panic(tree, state, "split", ret); prealloc = NULL; goto out; } @@ -748,7 +748,7 @@ out: if (prealloc) btrfs_free_extent_state(prealloc); - return 0; + return ret; } |