[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v6 14/17] hw/pci-bridge/pcie_pci_bridge: Omit errp for pci_add_ca
From: |
Akihiko Odaki |
Subject: |
[PATCH v6 14/17] hw/pci-bridge/pcie_pci_bridge: Omit errp for pci_add_capability |
Date: |
Mon, 31 Oct 2022 21:33:16 +0900 |
Omitting errp for pci_add_capability() causes it to abort if
capabilities overlap. This behavior is appropriate heare 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/pci-bridge/pcie_pci_bridge.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/hw/pci-bridge/pcie_pci_bridge.c b/hw/pci-bridge/pcie_pci_bridge.c
index 99778e3e24..1b839465e7 100644
--- a/hw/pci-bridge/pcie_pci_bridge.c
+++ b/hw/pci-bridge/pcie_pci_bridge.c
@@ -35,7 +35,7 @@ static void pcie_pci_bridge_realize(PCIDevice *d, Error
**errp)
{
PCIBridge *br = PCI_BRIDGE(d);
PCIEPCIBridge *pcie_br = PCIE_PCI_BRIDGE_DEV(d);
- int rc, pos;
+ int rc;
pci_bridge_initfn(d, TYPE_PCI_BUS);
@@ -49,12 +49,8 @@ static void pcie_pci_bridge_realize(PCIDevice *d, Error
**errp)
pcie_cap_init(d, 0, PCI_EXP_TYPE_PCI_BRIDGE, 0);
- pos = pci_add_capability(d, PCI_CAP_ID_PM, 0, PCI_PM_SIZEOF, errp);
- if (pos < 0) {
- goto pm_error;
- }
- d->exp.pm_cap = pos;
- pci_set_word(d->config + pos + PCI_PM_PMC, 0x3);
+ d->exp.pm_cap = pci_add_capability(d, PCI_CAP_ID_PM, 0, PCI_PM_SIZEOF);
+ pci_set_word(d->config + d->exp.pm_cap + PCI_PM_PMC, 0x3);
pcie_cap_arifwd_init(d);
pcie_cap_deverr_init(d);
@@ -85,7 +81,6 @@ static void pcie_pci_bridge_realize(PCIDevice *d, Error
**errp)
msi_error:
pcie_aer_exit(d);
aer_error:
-pm_error:
pcie_cap_exit(d);
shpc_cleanup(d, &pcie_br->shpc_bar);
error:
--
2.38.1
- [PATCH v6 04/17] ahci: Omit errp for pci_add_capability, (continued)
- [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, 2022/10/31
- [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 <=
- [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