qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Blue Swirl <blauwirbel@gmail.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH 8/9] lsi53c895a: avoid a warning from clang analyzer
Date: Sun, 04 Sep 2011 19:20:24 +0300	[thread overview]
Message-ID: <4E63A548.10907@redhat.com> (raw)
In-Reply-To: <CAAu8pHsw1cTK7u+FNevgWUC2J8jxLSuSmjtF=wR5Ae8mk9eibA@mail.gmail.com>

On 09/04/2011 06:53 PM, Blue Swirl wrote:
> Avoid this warning from clang analyzer by adjusting the scope
> of the variable:
> /src/qemu/hw/lsi53c895a.c:895:5: warning: Value stored to 'id' is never read
>      id = (current_tag>>  8)&  0xf;
>
> Signed-off-by: Blue Swirl<blauwirbel@gmail.com>
> ---
>   hw/lsi53c895a.c |   14 ++++++++------
>   1 files changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c
> index 1643a63..9d900d0 100644
> --- a/hw/lsi53c895a.c
> +++ b/hw/lsi53c895a.c
> @@ -883,7 +883,6 @@ static void lsi_do_msgout(LSIState *s)
>       int len;
>       uint32_t current_tag;
>       lsi_request *current_req, *p, *p_next;
> -    int id;
>
>       if (s->current) {
>           current_tag = s->current->tag;
> @@ -892,7 +891,6 @@ static void lsi_do_msgout(LSIState *s)
>           current_tag = s->select_tag;
>           current_req = lsi_find_by_tag(s, current_tag);
>       }
> -    id = (current_tag>>  8)&  0xf;
>
>       DPRINTF("MSG out len=%d\n", s->dbc);
>       while (s->dbc) {
> @@ -977,10 +975,14 @@ static void lsi_do_msgout(LSIState *s)
>                  device, but this is currently not implemented (and seems not
>                  to be really necessary). So let's simply clear all queued
>                  commands for the current device: */
> -            id = current_tag&  0x0000ff00;
> -            QTAILQ_FOREACH_SAFE(p,&s->queue, next, p_next) {
> -                if ((p->tag&  0x0000ff00) == id) {
> -                    scsi_req_cancel(p->req);
> +            {
> +                int id;
> +
> +                id = current_tag&  0x0000ff00;
> +                QTAILQ_FOREACH_SAFE(p,&s->queue, next, p_next) {
> +                    if ((p->tag&  0x0000ff00) == id) {
> +                        scsi_req_cancel(p->req);
> +                    }
>                   }
>               }
>

Why not keep id declared in the outer scope?  This extra indentation is 
annoying.


-- 
error compiling committee.c: too many arguments to function

  reply	other threads:[~2011-09-04 16:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-04 15:53 [Qemu-devel] [PATCH 8/9] lsi53c895a: avoid a warning from clang analyzer Blue Swirl
2011-09-04 16:20 ` Avi Kivity [this message]
2011-09-04 16:27   ` Blue Swirl
2011-09-05  5:35     ` Avi Kivity
2011-09-04 17:05   ` Peter Maydell

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=4E63A548.10907@redhat.com \
    --to=avi@redhat.com \
    --cc=blauwirbel@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.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 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).