[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v9 08/17] msi: Omit errp for pci_add_capability
From: |
Akihiko Odaki |
Subject: |
[PATCH v9 08/17] msi: Omit errp for pci_add_capability |
Date: |
Tue, 1 Nov 2022 23:55:49 +0900 |
Omitting errp for pci_add_capability() causes it to abort if
capabilities overlap. A caller of msi_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/msi.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/hw/pci/msi.c b/hw/pci/msi.c
index 058d1d1ef1..5283a08b5a 100644
--- a/hw/pci/msi.c
+++ b/hw/pci/msi.c
@@ -194,7 +194,6 @@ int msi_init(struct PCIDevice *dev, uint8_t offset,
unsigned int vectors_order;
uint16_t flags;
uint8_t cap_size;
- int config_offset;
if (!msi_nonbroken) {
error_setg(errp, "MSI is not supported by interrupt controller");
@@ -221,13 +220,7 @@ int msi_init(struct PCIDevice *dev, uint8_t offset,
}
cap_size = msi_cap_sizeof(flags);
- config_offset = pci_add_capability(dev, PCI_CAP_ID_MSI, offset,
- cap_size, errp);
- if (config_offset < 0) {
- return config_offset;
- }
-
- dev->msi_cap = config_offset;
+ dev->msi_cap = pci_add_capability(dev, PCI_CAP_ID_MSI, offset, cap_size);
dev->cap_present |= QEMU_PCI_CAP_MSI;
pci_set_word(dev->config + msi_flags_off(dev), flags);
--
2.38.1
- [PATCH v9 00/17] pci: Abort if pci_add_capability fails, Akihiko Odaki, 2022/11/01
- [PATCH v9 01/17] hw/vfio/pci: Ensure MSI and MSI-X do not overlap, Akihiko Odaki, 2022/11/01
- [PATCH v9 02/17] pci: Allow to omit errp for pci_add_capability, Akihiko Odaki, 2022/11/01
- [PATCH v9 03/17] hw/i386/amd_iommu: Omit errp for pci_add_capability, Akihiko Odaki, 2022/11/01
- [PATCH v9 04/17] ahci: Omit errp for pci_add_capability, Akihiko Odaki, 2022/11/01
- [PATCH v9 05/17] e1000e: Omit errp for pci_add_capability, Akihiko Odaki, 2022/11/01
- [PATCH v9 06/17] eepro100: Omit errp for pci_add_capability, Akihiko Odaki, 2022/11/01
- [PATCH v9 07/17] hw/nvme: Omit errp for pci_add_capability, Akihiko Odaki, 2022/11/01
- [PATCH v9 08/17] msi: Omit errp for pci_add_capability,
Akihiko Odaki <=
- [PATCH v9 09/17] hw/pci/pci_bridge: Omit errp for pci_add_capability, Akihiko Odaki, 2022/11/01
- [PATCH v9 10/17] pcie: Omit errp for pci_add_capability, Akihiko Odaki, 2022/11/01
- [PATCH v9 11/17] pci/shpc: Omit errp for pci_add_capability, Akihiko Odaki, 2022/11/01
- [PATCH v9 12/17] msix: Omit errp for pci_add_capability, Akihiko Odaki, 2022/11/01
- [PATCH v9 13/17] pci/slotid: Omit errp for pci_add_capability, Akihiko Odaki, 2022/11/01
- [PATCH v9 14/17] hw/pci-bridge/pcie_pci_bridge: Omit errp for pci_add_capability, Akihiko Odaki, 2022/11/01
- [PATCH v9 15/17] hw/vfio/pci: Omit errp for pci_add_capability, Akihiko Odaki, 2022/11/01
- [PATCH v9 16/17] virtio-pci: Omit errp for pci_add_capability, Akihiko Odaki, 2022/11/01
- [PATCH v9 17/17] pci: Remove legacy errp from pci_add_capability, Akihiko Odaki, 2022/11/01