Commit c64dd49b authored by Darrick J. Wong's avatar Darrick J. Wong

xfs: clean up xfs_buf_item_get_format return value

The only thing that can cause a nonzero return from
xfs_buf_item_get_format is if the kmem_alloc fails, which it can't.
Get rid of all the unnecessary error handling.
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
parent 0bb9d159
...@@ -688,7 +688,7 @@ static const struct xfs_item_ops xfs_buf_item_ops = { ...@@ -688,7 +688,7 @@ static const struct xfs_item_ops xfs_buf_item_ops = {
.iop_push = xfs_buf_item_push, .iop_push = xfs_buf_item_push,
}; };
STATIC int STATIC void
xfs_buf_item_get_format( xfs_buf_item_get_format(
struct xfs_buf_log_item *bip, struct xfs_buf_log_item *bip,
int count) int count)
...@@ -698,14 +698,11 @@ xfs_buf_item_get_format( ...@@ -698,14 +698,11 @@ xfs_buf_item_get_format(
if (count == 1) { if (count == 1) {
bip->bli_formats = &bip->__bli_format; bip->bli_formats = &bip->__bli_format;
return 0; return;
} }
bip->bli_formats = kmem_zalloc(count * sizeof(struct xfs_buf_log_format), bip->bli_formats = kmem_zalloc(count * sizeof(struct xfs_buf_log_format),
0); 0);
if (!bip->bli_formats)
return -ENOMEM;
return 0;
} }
STATIC void STATIC void
...@@ -731,7 +728,6 @@ xfs_buf_item_init( ...@@ -731,7 +728,6 @@ xfs_buf_item_init(
struct xfs_buf_log_item *bip = bp->b_log_item; struct xfs_buf_log_item *bip = bp->b_log_item;
int chunks; int chunks;
int map_size; int map_size;
int error;
int i; int i;
/* /*
...@@ -760,13 +756,7 @@ xfs_buf_item_init( ...@@ -760,13 +756,7 @@ xfs_buf_item_init(
* Discontiguous buffer support follows the layout of the underlying * Discontiguous buffer support follows the layout of the underlying
* buffer. This makes the implementation as simple as possible. * buffer. This makes the implementation as simple as possible.
*/ */
error = xfs_buf_item_get_format(bip, bp->b_map_count); xfs_buf_item_get_format(bip, bp->b_map_count);
ASSERT(error == 0);
if (error) { /* to stop gcc throwing set-but-unused warnings */
kmem_cache_free(xfs_buf_item_zone, bip);
return error;
}
for (i = 0; i < bip->bli_format_count; i++) { for (i = 0; i < bip->bli_format_count; i++) {
chunks = DIV_ROUND_UP(BBTOB(bp->b_maps[i].bm_len), chunks = DIV_ROUND_UP(BBTOB(bp->b_maps[i].bm_len),
......
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