linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: mwilck@arcor.de
Cc: linux-raid@vger.kernel.org
Subject: Re: [PATCH 1/6] DDF: ddf_activate_spare: fix gcc -O2 uninitialized warning
Date: Wed, 28 Aug 2013 14:57:57 +1000	[thread overview]
Message-ID: <20130828145757.0baad436@notabene.brown> (raw)
In-Reply-To: <1376677320-12816-2-git-send-email-mwilck@arcor.de>

[-- Attachment #1: Type: text/plain, Size: 1730 bytes --]

On Fri, 16 Aug 2013 20:21:55 +0200 mwilck@arcor.de wrote:

> The warning is spurious, but will break compilation with -O2.
> 
> Signed-off-by: Martin Wilck <mwilck@arcor.de>
> ---
>  super-ddf.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/super-ddf.c b/super-ddf.c
> index e3b3dca..95972ad 100644
> --- a/super-ddf.c
> +++ b/super-ddf.c
> @@ -4779,7 +4779,7 @@ static struct mdinfo *ddf_activate_spare(struct active_array *a,
>  	struct ddf_super *ddf = a->container->sb;
>  	int global_ok = 0;
>  	struct mdinfo *rv = NULL;
> -	struct mdinfo *di;
> +	struct mdinfo *di = NULL;
>  	struct metadata_update *mu;
>  	struct dl *dl;
>  	int i;

I fixed this differently as below.
Thanks,
NeilBrown

From bb925ff08beda785d42f5ff8a0f082d91c5caad4 Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.de>
Date: Fri, 16 Aug 2013 20:21:55 +0200
Subject: [PATCH] DDF: ddf_activate_spare: fix gcc -O2 uninitialized warning

At this point 'di' and 'rv' both have the same value.  gcc doesn't
realise that and a human reader might not either.
'rv' makes more sense too, so use that.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>

diff --git a/super-ddf.c b/super-ddf.c
index e3b3dca..ee6499a 100644
--- a/super-ddf.c
+++ b/super-ddf.c
@@ -4959,7 +4959,7 @@ static struct mdinfo *ddf_activate_spare(struct active_array *a,
 	 * Create a metadata_update record to update the
 	 * phys_refnum and lba_offset values
 	 */
-	vc = find_vdcr(ddf, a->info.container_member, di->disk.raid_disk,
+	vc = find_vdcr(ddf, a->info.container_member, rv->disk.raid_disk,
 		       &n_bvd, &vcl);
 	if (vc == NULL)
 		return NULL;

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

  reply	other threads:[~2013-08-28  4:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-16 18:21 [PATCH 0/6] Fixes for installation of CentOS 6 on DDF BIOS RAID mwilck
2013-08-16 18:21 ` [PATCH 1/6] DDF: ddf_activate_spare: fix gcc -O2 uninitialized warning mwilck
2013-08-28  4:57   ` NeilBrown [this message]
2013-08-16 18:21 ` [PATCH 2/6] DDF: export_examine_super_ddf: print MD_DEVICES mwilck
2013-08-16 18:21 ` [PATCH 3/6] DDF: container_content_ddf: set safe_mode_delay > 0 mwilck
2013-08-16 18:21 ` [PATCH 4/6] DDF: increase default value for safe_mode_delay to 4000ms mwilck
2013-08-16 18:21 ` [PATCH 5/6] in_initrd: fix gcc compiler error mwilck
2013-08-28  5:08   ` NeilBrown
2013-08-16 18:22 ` [PATCH 6/6] mdmon: allow disabling "@dmon" command name at compile time mwilck
2013-08-28  5:15   ` NeilBrown
2013-09-01 17:20     ` Martin Wilck
2013-09-02  1:07       ` NeilBrown
2013-09-02 18:47         ` Martin Wilck
2013-09-02 22:40           ` NeilBrown

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=20130828145757.0baad436@notabene.brown \
    --to=neilb@suse.de \
    --cc=linux-raid@vger.kernel.org \
    --cc=mwilck@arcor.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;
as well as URLs for NNTP newsgroup(s).