[PATCH -next] btrfs: Fix return value while kcalloc fails in btrfs_rmap_block

From: YueHaibing
Date: Wed Jan 15 2020 - 09:20:47 EST


In btrfs_rmap_block(), if kcalloc fails, it should return
-ENOMEM instead of 0.

Fixes: 767f58cdaf20 ("btrfs: Refactor btrfs_rmap_block to improve readability")
Signed-off-by: YueHaibing <yuehaibing@xxxxxxxxxx>
---
fs/btrfs/block-group.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
index 8877af5..1485158 100644
--- a/fs/btrfs/block-group.c
+++ b/fs/btrfs/block-group.c
@@ -1655,7 +1655,7 @@ int btrfs_rmap_block(struct btrfs_fs_info *fs_info, u64 chunk_start,
*stripe_len = io_stripe_size;
out:
free_extent_map(em);
- return 0;
+ return ret;
}

static int exclude_super_stripes(struct btrfs_block_group *cache)
--
2.7.4