summaryrefslogtreecommitdiff
path: root/file-item.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2016-08-31 20:38:46 +0200
committerDavid Sterba <dsterba@suse.com>2016-09-21 14:12:38 +0200
commit1ef93ea8632b89598d7723a04a2d268b70333168 (patch)
tree48e911e91131e2023534ae8dbd652d245a039f15 /file-item.c
parentb318553f33dc59b6afdc7d264dcfbfe835ccc3d4 (diff)
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 <dsterba@suse.com>
Diffstat (limited to 'file-item.c')
-rw-r--r--file-item.c7
1 files changed, 5 insertions, 2 deletions
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;