diff mbox series

hw/scsi: remove dead code

Message ID ea41618a040224242fced25fc3d09d3b1f75a06a.camel@gmail.com
State New
Headers show
Series hw/scsi: remove dead code | expand

Commit Message

Elena Afanasova Oct. 12, 2020, 1:32 p.m. UTC
Since MEGASAS_MAX_SGE is defined to be 128 the following if statement can be removed.
Spotted by PVS-Studio.

Signed-off-by: Elena Afanasova <eafanasova@gmail.com>
---
 hw/scsi/megasas.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Philippe Mathieu-Daudé Oct. 12, 2020, 1:35 p.m. UTC | #1
Hi Elena,

On 10/12/20 3:32 PM, Elena Afanasova wrote:
> Since MEGASAS_MAX_SGE is defined to be 128 the following if statement can be removed.
> Spotted by PVS-Studio.
> 
> Signed-off-by: Elena Afanasova <eafanasova@gmail.com>
> ---
>   hw/scsi/megasas.c | 2 --
>   1 file changed, 2 deletions(-)
> 
> diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
> index e24c12d7ee..6dcaad55fa 100644
> --- a/hw/scsi/megasas.c
> +++ b/hw/scsi/megasas.c
> @@ -2393,8 +2393,6 @@ static void megasas_scsi_realize(PCIDevice *dev, Error **errp)
>       }
>       if (s->fw_sge >= MEGASAS_MAX_SGE - MFI_PASS_FRAME_SIZE) {
>           s->fw_sge = MEGASAS_MAX_SGE - MFI_PASS_FRAME_SIZE;
> -    } else if (s->fw_sge >= 128 - MFI_PASS_FRAME_SIZE) {
> -        s->fw_sge = 128 - MFI_PASS_FRAME_SIZE;

See previous discussion:
https://www.mail-archive.com/qemu-devel@nongnu.org/msg668850.html

>       } else {
>           s->fw_sge = 64 - MFI_PASS_FRAME_SIZE;
>       }
>
diff mbox series

Patch

diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
index e24c12d7ee..6dcaad55fa 100644
--- a/hw/scsi/megasas.c
+++ b/hw/scsi/megasas.c
@@ -2393,8 +2393,6 @@  static void megasas_scsi_realize(PCIDevice *dev, Error **errp)
     }
     if (s->fw_sge >= MEGASAS_MAX_SGE - MFI_PASS_FRAME_SIZE) {
         s->fw_sge = MEGASAS_MAX_SGE - MFI_PASS_FRAME_SIZE;
-    } else if (s->fw_sge >= 128 - MFI_PASS_FRAME_SIZE) {
-        s->fw_sge = 128 - MFI_PASS_FRAME_SIZE;
     } else {
         s->fw_sge = 64 - MFI_PASS_FRAME_SIZE;
     }