Commit 170041f7 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Dave Chinner

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: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
parent 289ae7b4
...@@ -689,16 +689,12 @@ xfs_buf_get_map( ...@@ -689,16 +689,12 @@ xfs_buf_get_map(
return error; return error;
error = xfs_buf_allocate_memory(new_bp, flags); error = xfs_buf_allocate_memory(new_bp, flags);
if (error) { if (error)
xfs_buf_free(new_bp); goto out_free_buf;
return error;
}
error = xfs_buf_find(target, map, nmaps, flags, new_bp, &bp); error = xfs_buf_find(target, map, nmaps, flags, new_bp, &bp);
if (error) { if (error)
xfs_buf_free(new_bp); goto out_free_buf;
return error;
}
if (bp != new_bp) if (bp != new_bp)
xfs_buf_free(new_bp); xfs_buf_free(new_bp);
...@@ -726,6 +722,9 @@ xfs_buf_get_map( ...@@ -726,6 +722,9 @@ xfs_buf_get_map(
trace_xfs_buf_get(bp, flags, _RET_IP_); trace_xfs_buf_get(bp, flags, _RET_IP_);
*bpp = bp; *bpp = bp;
return 0; return 0;
out_free_buf:
xfs_buf_free(new_bp);
return error;
} }
int int
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment