Skip to content

Commit 3d693c5

Browse files
fdmananakdave
authored andcommitted
btrfs: remove pointless out label from add_new_free_space_info()
We can just return directly if btrfs_insert_empty_item() fails, there is no need to release the path before returning, as all callers (or upper in the call chain) will free the path if they get an error from the call to add_new_free_space_info(), which is also a common pattern everywhere in btrfs. Finally there's no need to set 'ret' to 0 if the call to btrfs_insert_empty_item() didn't fail, since 'ret' is already 0. Reviewed-by: Boris Burkov <[email protected]> Signed-off-by: Filipe Manana <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent c123012 commit 3d693c5

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

fs/btrfs/free-space-tree.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,15 @@ static int add_new_free_space_info(struct btrfs_trans_handle *trans,
8282

8383
ret = btrfs_insert_empty_item(trans, root, path, &key, sizeof(*info));
8484
if (ret)
85-
goto out;
85+
return ret;
8686

8787
leaf = path->nodes[0];
8888
info = btrfs_item_ptr(leaf, path->slots[0],
8989
struct btrfs_free_space_info);
9090
btrfs_set_free_space_extent_count(leaf, info, 0);
9191
btrfs_set_free_space_flags(leaf, info, 0);
92-
93-
ret = 0;
94-
out:
9592
btrfs_release_path(path);
96-
return ret;
93+
return 0;
9794
}
9895

9996
EXPORT_FOR_TESTS

0 commit comments

Comments
 (0)