[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v8 12/17] msix: Omit errp for pci_add_capability
From: |
Akihiko Odaki |
Subject: |
[PATCH v8 12/17] msix: Omit errp for pci_add_capability |
Date: |
Tue, 1 Nov 2022 22:57:44 +0900 |
Omitting errp for pci_add_capability() causes it to abort if
capabilities overlap. A caller of msix_init(), which calls
pci_add_capability() in turn, is expected to ensure that will not
happen.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
hw/pci/msix.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/hw/pci/msix.c b/hw/pci/msix.c
index 1e381a9813..28af83403b 100644
--- a/hw/pci/msix.c
+++ b/hw/pci/msix.c
@@ -311,7 +311,7 @@ int msix_init(struct PCIDevice *dev, unsigned short
nentries,
uint8_t pba_bar_nr, unsigned pba_offset, uint8_t cap_pos,
Error **errp)
{
- int cap;
+ uint8_t cap;
unsigned table_size, pba_size;
uint8_t *config;
@@ -340,11 +340,7 @@ int msix_init(struct PCIDevice *dev, unsigned short
nentries,
return -EINVAL;
}
- cap = pci_add_capability(dev, PCI_CAP_ID_MSIX,
- cap_pos, MSIX_CAP_LENGTH, errp);
- if (cap < 0) {
- return cap;
- }
+ cap = pci_add_capability(dev, PCI_CAP_ID_MSIX, cap_pos, MSIX_CAP_LENGTH);
dev->msix_cap = cap;
dev->cap_present |= QEMU_PCI_CAP_MSIX;
--
2.38.1
- Re: [PATCH v8 01/17] hw/vfio/pci: Ensure MSI and MSI-X do not overlap, (continued)
- [PATCH v8 03/17] hw/i386/amd_iommu: Omit errp for pci_add_capability, Akihiko Odaki, 2022/11/01
- [PATCH v8 04/17] ahci: Omit errp for pci_add_capability, Akihiko Odaki, 2022/11/01
- [PATCH v8 05/17] e1000e: Omit errp for pci_add_capability, Akihiko Odaki, 2022/11/01
- [PATCH v8 06/17] eepro100: Omit errp for pci_add_capability, Akihiko Odaki, 2022/11/01
- [PATCH v8 07/17] hw/nvme: Omit errp for pci_add_capability, Akihiko Odaki, 2022/11/01
- [PATCH v8 08/17] msi: Omit errp for pci_add_capability, Akihiko Odaki, 2022/11/01
- [PATCH v8 09/17] hw/pci/pci_bridge: Omit errp for pci_add_capability, Akihiko Odaki, 2022/11/01
- [PATCH v8 10/17] pcie: Omit errp for pci_add_capability, Akihiko Odaki, 2022/11/01
- [PATCH v8 11/17] pci/shpc: Omit errp for pci_add_capability, Akihiko Odaki, 2022/11/01
- [PATCH v8 12/17] msix: Omit errp for pci_add_capability,
Akihiko Odaki <=
- [PATCH v8 13/17] pci/slotid: Omit errp for pci_add_capability, Akihiko Odaki, 2022/11/01
- [PATCH v8 14/17] hw/pci-bridge/pcie_pci_bridge: Omit errp for pci_add_capability, Akihiko Odaki, 2022/11/01
- [PATCH v8 15/17] hw/vfio/pci: Omit errp for pci_add_capability, Akihiko Odaki, 2022/11/01
- [PATCH v8 16/17] virtio-pci: Omit errp for pci_add_capability, Akihiko Odaki, 2022/11/01
- [PATCH v8 17/17] pci: Remove legacy errp from pci_add_capability, Akihiko Odaki, 2022/11/01