OSDN Git Service

btrfs: simplify cleanup after error in btrfs_create_tree
authorPeng Hao <flyingpeng@tencent.com>
Fri, 7 Oct 2022 16:33:35 +0000 (18:33 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 5 Dec 2022 17:00:36 +0000 (18:00 +0100)
Since leaf is already NULL, and no other branch will go to fail_unlock,
the fail_unlock label is useless and can be removed

Signed-off-by: Peng Hao <flyingpeng@tencent.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/disk-io.c

index d99bf7c..3460eaa 100644 (file)
@@ -1197,7 +1197,7 @@ struct btrfs_root *btrfs_create_tree(struct btrfs_trans_handle *trans,
        if (IS_ERR(leaf)) {
                ret = PTR_ERR(leaf);
                leaf = NULL;
-               goto fail_unlock;
+               goto fail;
        }
 
        root->node = leaf;
@@ -1232,9 +1232,6 @@ struct btrfs_root *btrfs_create_tree(struct btrfs_trans_handle *trans,
 
        return root;
 
-fail_unlock:
-       if (leaf)
-               btrfs_tree_unlock(leaf);
 fail:
        btrfs_put_root(root);