diff options
author | David Sterba <dsterba@suse.com> | 2025-04-02 02:18:07 +0300 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2025-05-15 15:30:41 +0300 |
commit | 516748f584fd4308e93a503cbc876969b012de63 (patch) | |
tree | 6f29f96b9192cf8ee81721ef7c2db18dbaa3b7f3 /fs/btrfs/inode.c | |
parent | e235418118774fbe52cc558991aa769d2dbc9292 (diff) | |
download | linux-516748f584fd4308e93a503cbc876969b012de63.tar.xz |
btrfs: use BTRFS_PATH_AUTO_FREE in may_destroy_subvol()
This is the trivial pattern for path auto free, initialize at the
beginning and free at the end with simple goto -> return conversions.
Reviewed-by: Daniel Vacek <neelx@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r-- | fs/btrfs/inode.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index bc7e4c1ae015..03524a1e7fde 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -4475,7 +4475,7 @@ out: static noinline int may_destroy_subvol(struct btrfs_root *root) { struct btrfs_fs_info *fs_info = root->fs_info; - struct btrfs_path *path; + BTRFS_PATH_AUTO_FREE(path); struct btrfs_dir_item *di; struct btrfs_key key; struct fscrypt_str name = FSTR_INIT("default", 7); @@ -4497,7 +4497,7 @@ static noinline int may_destroy_subvol(struct btrfs_root *root) btrfs_err(fs_info, "deleting default subvolume %llu is not allowed", key.objectid); - goto out; + return ret; } btrfs_release_path(path); } @@ -4508,14 +4508,13 @@ static noinline int may_destroy_subvol(struct btrfs_root *root) ret = btrfs_search_slot(NULL, fs_info->tree_root, &key, path, 0, 0); if (ret < 0) - goto out; + return ret; if (ret == 0) { /* * Key with offset -1 found, there would have to exist a root * with such id, but this is out of valid range. */ - ret = -EUCLEAN; - goto out; + return -EUCLEAN; } ret = 0; @@ -4525,8 +4524,7 @@ static noinline int may_destroy_subvol(struct btrfs_root *root) if (key.objectid == btrfs_root_id(root) && key.type == BTRFS_ROOT_REF_KEY) ret = -ENOTEMPTY; } -out: - btrfs_free_path(path); + return ret; } |