From f389e7b982a14421dc6ec935552c39ea23da2f43 Mon Sep 17 00:00:00 2001 From: Filipe Manana Date: Wed, 9 Apr 2025 15:27:35 +0100 Subject: [PATCH] btrfs: remove duplicate error check at btrfs_clear_extent_bit_changeset() There's no need to check if split_state() returned an error twice, instead unify into a single if statement after setting 'prealloc' to NULL, because on error split_state() frees the 'prealloc' extent state record. Signed-off-by: Filipe Manana Reviewed-by: David Sterba Signed-off-by: David Sterba --- fs/btrfs/extent-io-tree.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/extent-io-tree.c b/fs/btrfs/extent-io-tree.c index 9f4f5829c55c..15400a0f899c 100644 --- a/fs/btrfs/extent-io-tree.c +++ b/fs/btrfs/extent-io-tree.c @@ -691,12 +691,11 @@ hit_next: if (!prealloc) goto search_again; err = split_state(tree, state, prealloc, start); - if (err) - extent_io_tree_panic(tree, state, "split", err); - prealloc = NULL; - if (err) + if (err) { + extent_io_tree_panic(tree, state, "split", err); goto out; + } if (state->end <= end) { state = clear_state_bit(tree, state, bits, wake, changeset); goto next; -- 2.50.1