Skip to content

Commit

Permalink
btrfs: unify the error handling of btrfs_read_buffer()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Qu Wenruo authored and David Sterba committed Mar 14, 2022
1 parent 4eb150d commit 9a4ffa1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions fs/btrfs/ctree.c
Original file line number Diff line number Diff line change
@@ -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;
}

/*

0 comments on commit 9a4ffa1

Please sign in to comment.