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 <[email protected]>
Signed-off-by: Chen Qun <[email protected]>
---
Cc: Paolo Bonzini <[email protected]>
Cc: Fam Zheng <[email protected]>
Cc: Hannes Reinecke <[email protected]>
Cc: [email protected]
---
 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;
     }
 
     memset(&info, 0, dcmd_size);
-- 
2.23.0



Reply via email to