diff options
author | Philippe Mathieu-Daudé <philmd@redhat.com> | 2019-12-17 18:34:00 +0100 |
---|---|---|
committer | Philippe Mathieu-Daudé <philmd@linaro.org> | 2023-06-13 11:28:58 +0200 |
commit | 48143e0fd2a57371e939750c14f9dd622f5c73a1 (patch) | |
tree | ff2c0dee3d213de8b1112fd9b3c67ee5c7dd4fe8 /include | |
parent | af33a321fabf9ae85781abe425acbfcbbbd99f9e (diff) | |
download | qemu-48143e0fd2a57371e939750c14f9dd622f5c73a1.zip qemu-48143e0fd2a57371e939750c14f9dd622f5c73a1.tar.gz qemu-48143e0fd2a57371e939750c14f9dd622f5c73a1.tar.bz2 |
hw/scsi/megasas: Silent GCC duplicated-cond warning
GCC9 is confused when building with CFLAG -O3:
hw/scsi/megasas.c: In function ‘megasas_scsi_realize’:
hw/scsi/megasas.c:2387:26: error: duplicated ‘if’ condition [-Werror=duplicated-cond]
2387 | } else if (s->fw_sge >= 128 - MFI_PASS_FRAME_SIZE) {
hw/scsi/megasas.c:2385:19: note: previously used here
2385 | if (s->fw_sge >= MEGASAS_MAX_SGE - MFI_PASS_FRAME_SIZE) {
cc1: all warnings being treated as errors
When this device was introduced in commit e8f943c3bcc, the author
cared about modularity, using a definition for the firmware limit.
However if the firmware limit isn't changed (MEGASAS_MAX_SGE = 128),
the code ends doing the same check twice.
Per the maintainer [*]:
> The original code assumed that one could change MFI_PASS_FRAME_SIZE,
> but it turned out not to be possible as it's being hardcoded in the
> drivers themselves (even though the interface provides mechanisms to
> query it). So we can remove the duplicate lines.
Add the 'MEGASAS_MIN_SGE' definition for the '64' magic value,
slightly rewrite the condition check to simplify a bit the logic
and remove the unnecessary / duplicated check.
[*] https://lore.kernel.org/qemu-devel/e0029fc5-882f-1d63-15e3-1c3dbe9b6a2c@suse.de/
Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Message-Id: <20230328210126.16282-1-philmd@linaro.org>
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions