btrfs-progs: mute coverity warnings about deadcode
authorEryu Guan <guaneryu@gmail.com>
Mon, 19 Oct 2015 11:37:55 +0000 (19:37 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 2 Nov 2015 08:35:05 +0000 (09:35 +0100)
Coverity reports execution cannot reach this statements. So put WARN_ON
in if-else conditions.

Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
backref.c

index 9a2efca25ccfc1d545eafdad71d209edb6c3c90d..8f41f829503d62489519e50dbaf84b311707ccfd 100644 (file)
--- a/backref.c
+++ b/backref.c
@@ -323,9 +323,9 @@ static int __resolve_indirect_ref(struct btrfs_fs_info *fs_info,
 
        eb = path->nodes[level];
        while (!eb) {
-               WARN_ON(!level);
                if (!level) {
                        ret = 1;
+                       WARN_ON(1);
                        goto out;
                }
                level--;
@@ -1178,7 +1178,6 @@ int extent_from_logical(struct btrfs_fs_info *fs_info, u64 logical,
                 logical, logical - found_key->objectid, found_key->objectid,
                 found_key->offset, flags, item_size);
 
-       WARN_ON(!flags_ret);
        if (flags_ret) {
                if (flags & BTRFS_EXTENT_FLAG_TREE_BLOCK)
                        *flags_ret = BTRFS_EXTENT_FLAG_TREE_BLOCK;
@@ -1187,9 +1186,10 @@ int extent_from_logical(struct btrfs_fs_info *fs_info, u64 logical,
                else
                        BUG_ON(1);
                return 0;
+       } else {
+               WARN_ON(1);
+               return -EIO;
        }
-
-       return -EIO;
 }
 
 /*