[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v6 03/17] hw/i386/amd_iommu: Omit errp for pci_add_capability
From: |
Akihiko Odaki |
Subject: |
[PATCH v6 03/17] hw/i386/amd_iommu: Omit errp for pci_add_capability |
Date: |
Mon, 31 Oct 2022 21:33:05 +0900 |
Omitting errp for pci_add_capability() causes it to abort if
capabilities overlap. This behavior is appropriate here because all of
the capabilities set in this device are defined in the program and
their overlap should not happen unless there is a programming error.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
hw/i386/amd_iommu.c | 21 ++++-----------------
1 file changed, 4 insertions(+), 17 deletions(-)
diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c
index 725f69095b..8a88cbea0a 100644
--- a/hw/i386/amd_iommu.c
+++ b/hw/i386/amd_iommu.c
@@ -1539,7 +1539,6 @@ static void amdvi_sysbus_reset(DeviceState *dev)
static void amdvi_sysbus_realize(DeviceState *dev, Error **errp)
{
- int ret = 0;
AMDVIState *s = AMD_IOMMU_DEVICE(dev);
MachineState *ms = MACHINE(qdev_get_machine());
PCMachineState *pcms = PC_MACHINE(ms);
@@ -1553,23 +1552,11 @@ static void amdvi_sysbus_realize(DeviceState *dev,
Error **errp)
if (!qdev_realize(DEVICE(&s->pci), &bus->qbus, errp)) {
return;
}
- ret = pci_add_capability(&s->pci.dev, AMDVI_CAPAB_ID_SEC, 0,
- AMDVI_CAPAB_SIZE, errp);
- if (ret < 0) {
- return;
- }
- s->capab_offset = ret;
+ s->capab_offset = pci_add_capability(&s->pci.dev, AMDVI_CAPAB_ID_SEC, 0,
+ AMDVI_CAPAB_SIZE);
- ret = pci_add_capability(&s->pci.dev, PCI_CAP_ID_MSI, 0,
- AMDVI_CAPAB_REG_SIZE, errp);
- if (ret < 0) {
- return;
- }
- ret = pci_add_capability(&s->pci.dev, PCI_CAP_ID_HT, 0,
- AMDVI_CAPAB_REG_SIZE, errp);
- if (ret < 0) {
- return;
- }
+ pci_add_capability(&s->pci.dev, PCI_CAP_ID_MSI, 0, AMDVI_CAPAB_REG_SIZE);
+ pci_add_capability(&s->pci.dev, PCI_CAP_ID_HT, 0, AMDVI_CAPAB_REG_SIZE);
/* Pseudo address space under root PCI bus. */
x86ms->ioapic_as = amdvi_host_dma_iommu(bus, s, AMDVI_IOAPIC_SB_DEVID);
--
2.38.1
- [PATCH v6 00/17] pci: Abort if pci_add_capability fails, Akihiko Odaki, 2022/10/31
- [PATCH v6 01/17] hw/vfio/pci: Ensure MSI and MSI-X do not overlap, Akihiko Odaki, 2022/10/31
- [PATCH v6 02/17] pci: Allow to omit errp for pci_add_capability, Akihiko Odaki, 2022/10/31
- [PATCH v6 06/17] eepro100: Omit errp for pci_add_capability, Akihiko Odaki, 2022/10/31
- [PATCH v6 04/17] ahci: Omit errp for pci_add_capability, Akihiko Odaki, 2022/10/31
- [PATCH v6 09/17] hw/pci/pci_bridge: Omit errp for pci_add_capability, Akihiko Odaki, 2022/10/31
- [PATCH v6 05/17] e1000e: Omit errp for pci_add_capability, Akihiko Odaki, 2022/10/31
- [PATCH v6 08/17] msi: Omit errp for pci_add_capability, Akihiko Odaki, 2022/10/31
- [PATCH v6 03/17] hw/i386/amd_iommu: Omit errp for pci_add_capability,
Akihiko Odaki <=
- [PATCH v6 10/17] pcie: Omit errp for pci_add_capability, Akihiko Odaki, 2022/10/31
- [PATCH v6 13/17] pci/slotid: Omit errp for pci_add_capability, Akihiko Odaki, 2022/10/31
- [PATCH v6 07/17] hw/nvme: Omit errp for pci_add_capability, Akihiko Odaki, 2022/10/31
- [PATCH v6 11/17] pci/shpc: Omit errp for pci_add_capability, Akihiko Odaki, 2022/10/31
- [PATCH v6 12/17] msix: Omit errp for pci_add_capability, Akihiko Odaki, 2022/10/31
- [PATCH v6 14/17] hw/pci-bridge/pcie_pci_bridge: Omit errp for pci_add_capability, Akihiko Odaki, 2022/10/31
- [PATCH v6 16/17] virtio-pci: Omit errp for pci_add_capability, Akihiko Odaki, 2022/10/31
- [PATCH v6 17/17] pci: Remove legacy errp from pci_add_capability, Akihiko Odaki, 2022/10/31
- [PATCH v6 15/17] hw/vfio/pci: Omit errp for pci_add_capability, Akihiko Odaki, 2022/10/31
- Re: [PATCH v6 00/17] pci: Abort if pci_add_capability fails, Michael S. Tsirkin, 2022/10/31