All of lore.kernel.org
 help / color / mirror / Atom feed
From: jes.sorensen@gmail.com
To: NeilBrown <neilb@suse.com>
Cc: linux-raid@vger.kernel.org, Michael Shigorin <mike@altlinux.org>
Subject: Re: [PATCH - mdadm] examine: tidy up some code.
Date: Mon, 06 Mar 2017 16:34:04 -0500	[thread overview]
Message-ID: <wrfjvarmks37.fsf@gmail.com> (raw)
In-Reply-To: <878tonnsfn.fsf@notabene.neil.brown.name> (NeilBrown's message of "Fri, 03 Mar 2017 10:57:00 +1100")

NeilBrown <neilb@suse.com> writes:
> Michael Shigorin reports that the 'lcc' compiler isn't able
> to deduce that 'st' must be initialized in
>
> 		if (c->SparcAdjust)
> 			st->ss->update_super(st, NULL, "sparc2.2",
>
> just because the only times it isn't initialised, 'err' is set non-zero.
>
> This results in a 'possibly uninitialised' warning.
> While there is no bug in the code, this does suggest that maybe
> the code could be made more obviously correct.
>
> So this patch:
>  1/ moves the "err" variable inside the for loop, so an error in
>     one device doesn't stop the other devices from being processed
>  2/ calls 'continue' early if the device cannot be opened, so that
>     a level of indent can be removed, and so that it is clear that
>     'st' is always initialised before being used
>  3/ frees 'st' if an error occured in load_super or load_container.
>
> Reported-by: Michael Shigorin <mike@altlinux.org>
> Signed-off-by: NeilBrown <neilb@suse.com>
> ---
>  Examine.c | 75 +++++++++++++++++++++++++++++++++------------------------------
>  1 file changed, 39 insertions(+), 36 deletions(-)

Applied!

Thanks,
Jes

      reply	other threads:[~2017-03-06 21:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-02 23:57 [PATCH - mdadm] examine: tidy up some code NeilBrown
2017-03-06 21:34 ` jes.sorensen [this message]

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=wrfjvarmks37.fsf@gmail.com \
    --to=jes.sorensen@gmail.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=mike@altlinux.org \
    --cc=neilb@suse.com \
    /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.