All of lore.kernel.org
 help / color / mirror / Atom feed
From: <ye.xingchen@zte.com.cn>
To: <clm@fb.com>
Cc: <josef@toxicpanda.com>, <dsterba@suse.com>,
	<linux-btrfs@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH] btrfs: scrub: Remove compilation errors when -Werror=maybe-uninitialized
Date: Thu, 19 Jan 2023 13:57:13 +0800 (CST)	[thread overview]
Message-ID: <202301191357131455025@zte.com.cn> (raw)

From: ye xingchen <ye.xingchen@zte.com.cn>

fs/btrfs/scrub.c: In function
'scrub_raid56_data_stripe_for_parity.isa.0':
fs/btrfs/scrub.c:3297:9 error: 'ret' may be used uninitialized in this
function [-Werror=maybe-uninitialized]

fs/btrfs/scrub.c: In function
'scrub_simple_mirror':
fs/btrfs/scrub.c:3530:9 error: 'ret' may be used uninitialized in this
function [-Werror=maybe-uninitialized]

Initialize 'ret' to aviod compilation errors.

Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
---
 fs/btrfs/scrub.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index a5d026041be4..d0ddf930cb79 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -3198,7 +3198,7 @@ static int scrub_raid56_data_stripe_for_parity(struct scrub_ctx *sctx,
 	struct btrfs_root *extent_root = btrfs_extent_root(fs_info, logical);
 	struct btrfs_root *csum_root = btrfs_csum_root(fs_info, logical);
 	u64 cur_logical = logical;
-	int ret;
+	int ret = 0;

 	ASSERT(map->type & BTRFS_BLOCK_GROUP_RAID56_MASK);

@@ -3424,7 +3424,7 @@ static int scrub_simple_mirror(struct scrub_ctx *sctx,
 	const u32 max_length = SZ_64K;
 	struct btrfs_path path = { 0 };
 	u64 cur_logical = logical_start;
-	int ret;
+	int ret = 0;

 	/* The range must be inside the bg */
 	ASSERT(logical_start >= bg->start && logical_end <= bg->start + bg->length);
-- 
2.25.1

             reply	other threads:[~2023-01-19  5:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-19  5:57 ye.xingchen [this message]
2023-01-19 11:04 ` [PATCH] btrfs: scrub: Remove compilation errors when -Werror=maybe-uninitialized David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202301191357131455025@zte.com.cn \
    --to=ye.xingchen@zte.com.cn \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.