diff options
author | David Sterba <dsterba@suse.com> | 2016-08-31 20:38:46 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-09-21 14:12:38 +0200 |
commit | 1ef93ea8632b89598d7723a04a2d268b70333168 (patch) | |
tree | 48e911e91131e2023534ae8dbd652d245a039f15 /root-tree.c | |
parent | b318553f33dc59b6afdc7d264dcfbfe835ccc3d4 (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 'root-tree.c')
-rw-r--r-- | root-tree.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/root-tree.c b/root-tree.c index 934d02ef..cca424e3 100644 --- a/root-tree.c +++ b/root-tree.c @@ -31,12 +31,14 @@ int btrfs_find_last_root(struct btrfs_root *root, u64 objectid, int ret; int slot; + path = btrfs_alloc_path(); + if (!path) + return -ENOMEM; + search_key.objectid = objectid; search_key.type = BTRFS_ROOT_ITEM_KEY; search_key.offset = (u64)-1; - path = btrfs_alloc_path(); - BUG_ON(!path); ret = btrfs_search_slot(NULL, root, &search_key, path, 0, 0); if (ret < 0) goto out; @@ -74,7 +76,9 @@ int btrfs_update_root(struct btrfs_trans_handle *trans, struct btrfs_root u32 old_len; path = btrfs_alloc_path(); - BUG_ON(!path); + if (!path) + return -ENOMEM; + ret = btrfs_search_slot(trans, root, key, path, 0, 1); if (ret < 0) goto out; |