aboutsummaryrefslogtreecommitdiff
path: root/hw/scsi
diff options
context:
space:
mode:
authorLi Qiang <liq3ea@163.com>2020-08-15 07:19:39 -0700
committerPaolo Bonzini <pbonzini@redhat.com>2020-09-30 19:09:20 +0200
commit5ecfbae201d68a2f13df233260c77b0a25d7cd35 (patch)
tree6b7a804842be0d193af65a632a1bef7071ac357b /hw/scsi
parentafff2db61f6ace9bb2c4d81c7c57601f5c009acd (diff)
downloadqemu-arm-5ecfbae201d68a2f13df233260c77b0a25d7cd35.tar.gz
hw: megasas: return -1 when 'megasas_map_sgl' fails
The caller of 'megasas_map_sgl' will only check if the return is zero or not. If it return 0 it means success, as in the next patch we will consider 'iov_count=0' is an error, so let's return -1 to indicate a failure. Signed-off-by: Li Qiang <liq3ea@163.com> Message-Id: <20200815141940.44025-2-liq3ea@163.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/scsi')
-rw-r--r--hw/scsi/megasas.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
index e90c00823a..4cc709d2c6 100644
--- a/hw/scsi/megasas.c
+++ b/hw/scsi/megasas.c
@@ -280,7 +280,7 @@ static int megasas_map_sgl(MegasasState *s, MegasasCmd *cmd, union mfi_sgl *sgl)
if (iov_count > MEGASAS_MAX_SGE) {
trace_megasas_iovec_sgl_overflow(cmd->index, iov_count,
MEGASAS_MAX_SGE);
- return iov_count;
+ return -1;
}
pci_dma_sglist_init(&cmd->qsg, PCI_DEVICE(s), iov_count);
for (i = 0; i < iov_count; i++) {
@@ -310,7 +310,7 @@ static int megasas_map_sgl(MegasasState *s, MegasasCmd *cmd, union mfi_sgl *sgl)
return 0;
unmap:
qemu_sglist_destroy(&cmd->qsg);
- return iov_count - i;
+ return -1;
}
/*