diff mbox

btrfs-progs: Initialize ret to suppress compiler warning

Message ID 20161201172820.1139-1-rgoldwyn@suse.de (mailing list archive)
State Accepted
Headers show

Commit Message

Goldwyn Rodrigues Dec. 1, 2016, 5:28 p.m. UTC
From: Goldwyn Rodrigues <rgoldwyn@suse.com>

Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
---
 cmds-check.c    | 2 +-
 qgroup-verify.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

David Sterba Dec. 8, 2016, 3:13 p.m. UTC | #1
On Thu, Dec 01, 2016 at 11:28:20AM -0600, Goldwyn Rodrigues wrote:
> From: Goldwyn Rodrigues <rgoldwyn@suse.com>

The path that leaves ret unintialized goes through the second if block
and requires dback->found_ref to be 0. Quick search leads to several
places where it's set according to found items so we won't reach the for
loop with found_ref 0.

Cleaning up such compiler warnings is desired, but the fix description
should also say why it is ok to just set the value. Patch applied with
updated description.
--
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/cmds-check.c b/cmds-check.c
index 85eaa63..a9501f5 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -8041,7 +8041,7 @@  static int record_extent(struct btrfs_trans_handle *trans,
 			 struct extent_backref *back,
 			 int allocated, u64 flags)
 {
-	int ret;
+	int ret = 0;
 	struct btrfs_root *extent_root = info->extent_root;
 	struct extent_buffer *leaf;
 	struct btrfs_key ins_key;
diff --git a/qgroup-verify.c b/qgroup-verify.c
index 39762bf..ff46bc4 100644
--- a/qgroup-verify.c
+++ b/qgroup-verify.c
@@ -1575,7 +1575,7 @@  out:
 
 int repair_qgroups(struct btrfs_fs_info *info, int *repaired)
 {
-	int ret;
+	int ret = 0;
 	struct qgroup_count *count, *tmpcount;
 
 	*repaired = 0;