Btrfs-progs: fix wrong leaf when checking the trees relationship
[platform/upstream/btrfs-progs.git] / file-item.c
index 9732282..c746b44 100644 (file)
@@ -193,7 +193,7 @@ int btrfs_csum_file_block(struct btrfs_trans_handle *trans,
                          struct btrfs_root *root, u64 alloc_end,
                          u64 bytenr, char *data, size_t len)
 {
-       int ret;
+       int ret = 0;
        struct btrfs_key file_key;
        struct btrfs_key found_key;
        u64 next_offset = (u64)-1;
@@ -218,6 +218,7 @@ int btrfs_csum_file_block(struct btrfs_trans_handle *trans,
        item = btrfs_lookup_csum(trans, root, path, bytenr, 1);
        if (!IS_ERR(item)) {
                leaf = path->nodes[0];
+               ret = 0;
                goto found;
        }
        ret = PTR_ERR(item);