qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <laurent@vivier.eu>
To: Peter Maydell <peter.maydell@linaro.org>,
	Chen Qun <kuhn.chenqun@huawei.com>
Cc: Fam Zheng <fam@euphon.net>, Hannes Reinecke <hare@suse.com>,
	zhanghailiang <zhang.zhanghailiang@huawei.com>,
	Qemu-block <qemu-block@nongnu.org>,
	QEMU Trivial <qemu-trivial@nongnu.org>,
	QEMU Developers <qemu-devel@nongnu.org>,
	Euler Robot <euler.robot@huawei.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH] hw/scsi/megasas:Clean up some redundant code fix Clang warnings
Date: Tue, 10 Mar 2020 16:04:31 +0100	[thread overview]
Message-ID: <3e551fba-8bda-a2b4-d223-356493cac4db@vivier.eu> (raw)
In-Reply-To: <CAFEAcA_W2pRztEAmd1v+6O-1J9-CckVV8+G6kZ3igmR-ie6k+Q@mail.gmail.com>

Le 10/03/2020 à 14:46, Peter Maydell a écrit :
> On Tue, 10 Mar 2020 at 13:10, Chen Qun <kuhn.chenqun@huawei.com> wrote:
>>
>> Here are some redundant statements, we can clean them up.
>> Clang static code analyzer show warning:
>> hw/scsi/megasas.c:1175:32: warning: Value stored to 'max_ld_disks' during its initialization is never read
>>     uint32_t num_ld_disks = 0, max_ld_disks = s->fw_luns;
>>                                ^~~~~~~~~~~~   ~~~~~~~~~~
>> hw/scsi/megasas.c:1183:9: warning: Value stored to 'max_ld_disks' is never read
>>         max_ld_disks = 0;
>>         ^              ~
>>
>> Reported-by: Euler Robot <euler.robot@huawei.com>
>> Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
>> ---
>> Cc: Paolo Bonzini <pbonzini@redhat.com>
>> Cc: Fam Zheng <fam@euphon.net>
>> Cc: Hannes Reinecke <hare@suse.com>
>> Cc: qemu-block@nongnu.org
>> ---
>>  hw/scsi/megasas.c | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
>> index af18c88b65..3f982e1d3b 100644
>> --- a/hw/scsi/megasas.c
>> +++ b/hw/scsi/megasas.c
>> @@ -1172,7 +1172,7 @@ static int megasas_dcmd_ld_list_query(MegasasState *s, MegasasCmd *cmd)
>>      uint16_t flags;
>>      struct mfi_ld_targetid_list info;
>>      size_t dcmd_size = sizeof(info), resid;
>> -    uint32_t num_ld_disks = 0, max_ld_disks = s->fw_luns;
>> +    uint32_t num_ld_disks = 0, max_ld_disks;
>>      BusChild *kid;
>>
>>      /* mbox0 contains flags */
>> @@ -1180,7 +1180,6 @@ static int megasas_dcmd_ld_list_query(MegasasState *s, MegasasCmd *cmd)
>>      trace_megasas_dcmd_ld_list_query(cmd->index, flags);
>>      if (flags != MR_LD_QUERY_TYPE_ALL &&
>>          flags != MR_LD_QUERY_TYPE_EXPOSED_TO_HOST) {
>> -        max_ld_disks = 0;
>>      }
> 
> This doesn't look right -- your change removes the only statement
> in the body of this "if". I think you need to examine what the
> function is trying to do with the test it is doing on these flags
> in order to identify what the right change is... Probably this
> means going back to the h/w spec to identify the correct behaviour
> overall.

Moreover this "if" is the only user of MR_LD_QUERY_TYPE_ALL and
MR_LD_QUERY_TYPE_EXPOSED_TO_HOST.

Thanks,
Laurent



  reply	other threads:[~2020-03-10 15:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-10 13:08 [PATCH] hw/scsi/megasas:Clean up some redundant code fix Clang warnings Chen Qun
2020-03-10 13:46 ` Peter Maydell
2020-03-10 15:04   ` Laurent Vivier [this message]
2020-03-11  1:10   ` Chenqun (kuhn)
2020-03-10 13:58 ` no-reply
2020-03-10 15:01 ` Laurent Vivier
2020-03-11  6:48   ` Chenqun (kuhn)

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=3e551fba-8bda-a2b4-d223-356493cac4db@vivier.eu \
    --to=laurent@vivier.eu \
    --cc=euler.robot@huawei.com \
    --cc=fam@euphon.net \
    --cc=hare@suse.com \
    --cc=kuhn.chenqun@huawei.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=zhang.zhanghailiang@huawei.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 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).