[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 1/6] msix_init: assert programming error
From: |
Cao jin |
Subject: |
[Qemu-devel] [PATCH 1/6] msix_init: assert programming error |
Date: |
Wed, 17 Aug 2016 22:39:02 +0800 |
CC: Markus Armbruster <address@hidden>
CC: Marcel Apfelbaum <address@hidden>
CC: Michael S. Tsirkin <address@hidden>
Signed-off-by: Cao jin <address@hidden>
---
hw/pci/msix.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/hw/pci/msix.c b/hw/pci/msix.c
index 0ec1cb1..384a29d 100644
--- a/hw/pci/msix.c
+++ b/hw/pci/msix.c
@@ -253,9 +253,7 @@ int msix_init(struct PCIDevice *dev, unsigned short
nentries,
return -ENOTSUP;
}
- if (nentries < 1 || nentries > PCI_MSIX_FLAGS_QSIZE + 1) {
- return -EINVAL;
- }
+ assert(nentries >= 1 && nentries <= PCI_MSIX_FLAGS_QSIZE + 1);
table_size = nentries * PCI_MSIX_ENTRY_SIZE;
pba_size = QEMU_ALIGN_UP(nentries, 64) / 8;
@@ -266,7 +264,7 @@ int msix_init(struct PCIDevice *dev, unsigned short
nentries,
table_offset + table_size > memory_region_size(table_bar) ||
pba_offset + pba_size > memory_region_size(pba_bar) ||
(table_offset | pba_offset) & PCI_MSIX_FLAGS_BIRMASK) {
- return -EINVAL;
+ assert(0);
}
cap = pci_add_capability(dev, PCI_CAP_ID_MSIX, cap_pos, MSIX_CAP_LENGTH);
--
2.1.0
- Re: [Qemu-devel] [PATCH 4/6] e1000e: drop unnecessary funtions, (continued)
[Qemu-devel] [PATCH 5/6] megasas: remove unnecessary megasas_use_msix(), Cao jin, 2016/08/17
[Qemu-devel] [PATCH 6/6] megasas: undo the overwrites of user configuration, Cao jin, 2016/08/17
[Qemu-devel] [PATCH 1/6] msix_init: assert programming error,
Cao jin <=
[Qemu-devel] [PATCH 2/6] pci: Convert msix_init() to Error and fix callers to check it, Cao jin, 2016/08/17