diff mbox

[05/10] btrfs-progs: mute coverity warnings about deadcode

Message ID 1445254680-11102-6-git-send-email-guaneryu@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Eryu Guan Oct. 19, 2015, 11:37 a.m. UTC
Coverity reports execution cannot reach this statements. So put WARN_ON
in if-else conditions.

Signed-off-by: Eryu Guan <guaneryu@gmail.com>
---
 backref.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

David Sterba Oct. 21, 2015, 11:34 a.m. UTC | #1
On Mon, Oct 19, 2015 at 07:37:55PM +0800, Eryu Guan wrote:
> Coverity reports execution cannot reach this statements. So put WARN_ON
> in if-else conditions.
> 
> Signed-off-by: Eryu Guan <guaneryu@gmail.com>

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/backref.c b/backref.c
index 9a2efca..8f41f82 100644
--- 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;
 }
 
 /*