diff options
author | Qu Wenruo <wqu@suse.com> | 2022-02-22 15:41:20 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2022-03-14 13:13:53 +0100 |
commit | 9a4ffa1bd629c7c55a1238c65e58fe0ce9c12d08 (patch) | |
tree | b5bd70802000d419c8d24a804eb216aa763ac2ca /fs/btrfs | |
parent | 4eb150d6122bf51744d07c569ea811e8ce4bdd6d (diff) | |
download | linux-stable-9a4ffa1bd629c7c55a1238c65e58fe0ce9c12d08.tar.gz linux-stable-9a4ffa1bd629c7c55a1238c65e58fe0ce9c12d08.tar.bz2 linux-stable-9a4ffa1bd629c7c55a1238c65e58fe0ce9c12d08.zip |
btrfs: unify the error handling of btrfs_read_buffer()
There is one oddball error handling of btrfs_read_buffer():
ret = btrfs_read_buffer(tmp, gen, parent_level - 1, &first_key);
if (!ret) {
*eb_ret = tmp;
return 0;
}
free_extent_buffer(tmp);
btrfs_release_path(p);
return -EIO;
While all other call sites check the error first. Unify the behavior.
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/ctree.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 9b2d9cd41676..0eecf98d0abb 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c @@ -1438,13 +1438,13 @@ read_block_for_search(struct btrfs_root *root, struct btrfs_path *p, /* now we're allowed to do a blocking uptodate check */ ret = btrfs_read_buffer(tmp, gen, parent_level - 1, &first_key); - if (!ret) { - *eb_ret = tmp; - return 0; + if (ret) { + free_extent_buffer(tmp); + btrfs_release_path(p); + return -EIO; } - free_extent_buffer(tmp); - btrfs_release_path(p); - return -EIO; + *eb_ret = tmp; + return 0; } /* |