summaryrefslogtreecommitdiff
path: root/file-item.c
diff options
context:
space:
mode:
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;