From 1ef93ea8632b89598d7723a04a2d268b70333168 Mon Sep 17 00:00:00 2001 From: David Sterba Date: Wed, 31 Aug 2016 20:38:46 +0200 Subject: btrfs-progs: handle errors from btrfs_alloc_path All functions already return an error condition, so the callers should expect that. Signed-off-by: David Sterba --- file-item.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'file-item.c') diff --git a/file-item.c b/file-item.c index 7a3bbf35..55d2d475 100644 --- a/file-item.c +++ b/file-item.c @@ -42,7 +42,9 @@ int btrfs_insert_file_extent(struct btrfs_trans_handle *trans, struct extent_buffer *leaf; path = btrfs_alloc_path(); - BUG_ON(!path); + if (!path) + return -ENOMEM; + file_key.objectid = objectid; file_key.offset = pos; btrfs_set_key_type(&file_key, BTRFS_EXTENT_DATA_KEY); @@ -188,7 +190,8 @@ int btrfs_csum_file_block(struct btrfs_trans_handle *trans, btrfs_super_csum_size(root->fs_info->super_copy); path = btrfs_alloc_path(); - BUG_ON(!path); + if (!path) + return -ENOMEM; file_key.objectid = BTRFS_EXTENT_CSUM_OBJECTID; file_key.offset = bytenr; -- cgit v1.2.3