[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v8 13/17] pci/slotid: Omit errp for pci_add_capability
From: |
Akihiko Odaki |
Subject: |
[PATCH v8 13/17] pci/slotid: Omit errp for pci_add_capability |
Date: |
Tue, 1 Nov 2022 22:57:45 +0900 |
Omitting errp for pci_add_capability() causes it to abort if
capabilities overlap. A caller of slotid_cap_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/slotid_cap.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/hw/pci/slotid_cap.c b/hw/pci/slotid_cap.c
index 36d021b4a6..5da8c82133 100644
--- a/hw/pci/slotid_cap.c
+++ b/hw/pci/slotid_cap.c
@@ -12,7 +12,7 @@ int slotid_cap_init(PCIDevice *d, int nslots,
unsigned offset,
Error **errp)
{
- int cap;
+ uint8_t cap;
if (!chassis) {
error_setg(errp, "Bridge chassis not specified. Each bridge is
required"
@@ -24,11 +24,7 @@ int slotid_cap_init(PCIDevice *d, int nslots,
return -EINVAL;
}
- cap = pci_add_capability(d, PCI_CAP_ID_SLOTID, offset,
- SLOTID_CAP_LENGTH, errp);
- if (cap < 0) {
- return cap;
- }
+ cap = pci_add_capability(d, PCI_CAP_ID_SLOTID, offset, SLOTID_CAP_LENGTH);
/* We make each chassis unique, this way each bridge is First in Chassis */
d->config[cap + PCI_SID_ESR] = PCI_SID_ESR_FIC |
(nslots << SLOTID_NSLOTS_SHIFT);
--
2.38.1
- [PATCH v8 03/17] hw/i386/amd_iommu: Omit errp for pci_add_capability, (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, 2022/11/01
- [PATCH v8 13/17] pci/slotid: Omit errp for pci_add_capability,
Akihiko Odaki <=
- [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