From: Tim Gardner <tim.gardner@canonical.com>
To: linux-kernel@vger.kernel.org
Cc: Tim Gardner <tim.gardner@canonical.com>,
Alasdair Kergon <agk@redhat.com>,
dm-devel@redhat.com, Neil Brown <neilb@suse.de>,
linux-raid@vger.kernel.org
Subject: [PATCH linux-next v2] DM RAID: validate_raid_redundancy: Silence uninitialized variable warning
Date: Thu, 21 Feb 2013 07:50:26 -0700 [thread overview]
Message-ID: <1361458226-8142-1-git-send-email-tim.gardner@canonical.com> (raw)
In-Reply-To: <20130221131931.GA29577@agk-dp.fab.redhat.com>
drivers/md/dm-raid.c:453:53: warning: 'rebuilds_per_group' may be used uninitialized in this function [-Wuninitialized]
drivers/md/dm-raid.c:383:11: note: 'rebuilds_per_group' was declared here
It is impossible that rebuilds_per_group could be used before set, but set
it to 0 anyways to silence GCC warnings.
Cc: Alasdair Kergon <agk@redhat.com>
Cc: dm-devel@redhat.com
Cc: Neil Brown <neilb@suse.de>
Cc: linux-raid@vger.kernel.org
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---
v2 - Added GCC comment. Update commit log with a more definite explanation.
As Neil has pointed out, https://lwn.net/Articles/529954/ indicates
uninitialized_var() is going away.
drivers/md/dm-raid.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c
index 9d6bf19..1dbc341 100644
--- a/drivers/md/dm-raid.c
+++ b/drivers/md/dm-raid.c
@@ -380,7 +380,8 @@ static int validate_region_size(struct raid_set *rs, unsigned long region_size)
static int validate_raid_redundancy(struct raid_set *rs)
{
unsigned i, rebuild_cnt = 0;
- unsigned rebuilds_per_group, copies, d;
+ unsigned rebuilds_per_group = 0; /* GCC 4.6.3 */
+ unsigned copies, d;
unsigned group_size, last_group_start;
for (i = 0; i < rs->md.raid_disks; i++)
--
1.7.9.5
next prev parent reply other threads:[~2013-02-21 14:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-20 20:31 [PATCH linux-next] " Tim Gardner
2013-02-20 22:16 ` Paul Menzel
2013-02-20 22:18 ` Paul Menzel
2013-02-20 22:37 ` NeilBrown
2013-02-21 13:19 ` [dm-devel] " Alasdair G Kergon
2013-02-21 14:50 ` Tim Gardner [this message]
2013-06-13 15:30 ` [PATCH linux-next v2] " Tommi Rantala
2013-06-13 16:00 ` Tim Gardner
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=1361458226-8142-1-git-send-email-tim.gardner@canonical.com \
--to=tim.gardner@canonical.com \
--cc=agk@redhat.com \
--cc=dm-devel@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=neilb@suse.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®