There's no point in committing the transaction if we failed to delete the
item, since we haven't done anything before. Also stop using two variables
for tracking the return value and use only 'ret'.
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
struct btrfs_trans_handle *trans;
struct btrfs_path *path;
struct btrfs_key key;
- int ret, err;
+ int ret;
path = btrfs_alloc_path();
if (!path)
ret = btrfs_del_item(trans, root, path);
out:
btrfs_free_path(path);
- err = btrfs_commit_transaction(trans);
- if (err && !ret)
- ret = err;
+ if (ret == 0)
+ ret = btrfs_commit_transaction(trans);
+ else
+ btrfs_end_transaction(trans);
+
return ret;
}