diff mbox series

[11/27] btrfs: use BTRFS_PATH_AUTO_FREE in btrfs_read_tree_root()

Message ID bb67552e121757dfc177acc7a99a170967c33ce8.1740562070.git.dsterba@suse.com (mailing list archive)
State New
Headers show
Series Struct btrfs_path auto cleaning conversions | expand

Commit Message

David Sterba Feb. 26, 2025, 9:51 a.m. UTC
This is the trivial pattern for path auto free, initialize at the
beginning and free at the end.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/disk-io.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index a799216aa264..ab7cbbf90af3 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -1089,13 +1089,12 @@  struct btrfs_root *btrfs_read_tree_root(struct btrfs_root *tree_root,
 					const struct btrfs_key *key)
 {
 	struct btrfs_root *root;
-	struct btrfs_path *path;
+	BTRFS_PATH_AUTO_FREE(path);
 
 	path = btrfs_alloc_path();
 	if (!path)
 		return ERR_PTR(-ENOMEM);
 	root = read_tree_root_path(tree_root, path, key);
-	btrfs_free_path(path);
 
 	return root;
 }