diff options
author | Christoph Hellwig <hch@lst.de> | 2021-06-07 04:50:47 +0300 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2021-06-07 04:50:47 +0300 |
commit | 170041f71596dad3f34dea40ee0ef0c848d3f906 (patch) | |
tree | 81ccdbad520c9e8376ec27f978dcdd6ef6881510 /fs/xfs/xfs_buf.c | |
parent | 289ae7b48c2c4d9bec515e720c01146498109dee (diff) | |
download | linux-170041f71596dad3f34dea40ee0ef0c848d3f906.tar.xz |
xfs: cleanup error handling in xfs_buf_get_map
Use a single goto label for freeing the buffer and returning an
error.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Diffstat (limited to 'fs/xfs/xfs_buf.c')
-rw-r--r-- | fs/xfs/xfs_buf.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index 0b0d66d31515..7dea73535959 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c @@ -689,16 +689,12 @@ xfs_buf_get_map( return error; error = xfs_buf_allocate_memory(new_bp, flags); - if (error) { - xfs_buf_free(new_bp); - return error; - } + if (error) + goto out_free_buf; error = xfs_buf_find(target, map, nmaps, flags, new_bp, &bp); - if (error) { - xfs_buf_free(new_bp); - return error; - } + if (error) + goto out_free_buf; if (bp != new_bp) xfs_buf_free(new_bp); @@ -726,6 +722,9 @@ found: trace_xfs_buf_get(bp, flags, _RET_IP_); *bpp = bp; return 0; +out_free_buf: + xfs_buf_free(new_bp); + return error; } int |