[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v5 14/17] hw/pci-bridge/pcie_pci_bridge: Omit errp for pci_add_ca
From: |
Akihiko Odaki |
Subject: |
[PATCH v5 14/17] hw/pci-bridge/pcie_pci_bridge: Omit errp for pci_add_capability |
Date: |
Fri, 28 Oct 2022 21:26:26 +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.37.3
- [PATCH v5 04/17] ahci: Omit errp for pci_add_capability, (continued)
- [PATCH v5 04/17] ahci: Omit errp for pci_add_capability, Akihiko Odaki, 2022/10/28
- [PATCH v5 07/17] hw/nvme: Omit errp for pci_add_capability, Akihiko Odaki, 2022/10/28
- [PATCH v5 05/17] e1000e: Omit errp for pci_add_capability, Akihiko Odaki, 2022/10/28
- [PATCH v5 08/17] msi: Omit errp for pci_add_capability, Akihiko Odaki, 2022/10/28
- [PATCH v5 10/17] pcie: Omit errp for pci_add_capability, Akihiko Odaki, 2022/10/28
- [PATCH v5 09/17] hw/pci/pci_bridge: Omit errp for pci_add_capability, Akihiko Odaki, 2022/10/28
- [PATCH v5 02/17] pci: Allow to omit errp for pci_add_capability, Akihiko Odaki, 2022/10/28
- [PATCH v5 11/17] pci/shpc: Omit errp for pci_add_capability, Akihiko Odaki, 2022/10/28
- [PATCH v5 12/17] msix: Omit errp for pci_add_capability, Akihiko Odaki, 2022/10/28
- [PATCH v5 13/17] pci/slotid: Omit errp for pci_add_capability, Akihiko Odaki, 2022/10/28
- [PATCH v5 14/17] hw/pci-bridge/pcie_pci_bridge: Omit errp for pci_add_capability,
Akihiko Odaki <=
- [PATCH v5 16/17] virtio-pci: Omit errp for pci_add_capability, Akihiko Odaki, 2022/10/28
- [PATCH v5 17/17] pci: Remove legacy errp from pci_add_capability, Akihiko Odaki, 2022/10/28
- [PATCH v5 15/17] hw/vfio/pci: Omit errp for pci_add_capability, Akihiko Odaki, 2022/10/28