[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v8 07/17] hw/nvme: Omit errp for pci_add_capability
From: |
Akihiko Odaki |
Subject: |
[PATCH v8 07/17] hw/nvme: Omit errp for pci_add_capability |
Date: |
Tue, 1 Nov 2022 22:57:39 +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/nvme/ctrl.c | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index 87aeba0564..ff4e2beea6 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -7325,17 +7325,9 @@ static void nvme_init_sriov(NvmeCtrl *n, PCIDevice
*pci_dev, uint16_t offset)
PCI_BASE_ADDRESS_MEM_TYPE_64, bar_size);
}
-static int nvme_add_pm_capability(PCIDevice *pci_dev, uint8_t offset)
+static void nvme_add_pm_capability(PCIDevice *pci_dev, uint8_t offset)
{
- Error *err = NULL;
- int ret;
-
- ret = pci_add_capability(pci_dev, PCI_CAP_ID_PM, offset,
- PCI_PM_SIZEOF, &err);
- if (err) {
- error_report_err(err);
- return ret;
- }
+ pci_add_capability(pci_dev, PCI_CAP_ID_PM, offset, PCI_PM_SIZEOF);
pci_set_word(pci_dev->config + offset + PCI_PM_PMC,
PCI_PM_CAP_VER_1_2);
@@ -7343,8 +7335,6 @@ static int nvme_add_pm_capability(PCIDevice *pci_dev,
uint8_t offset)
PCI_PM_CTRL_NO_SOFT_RESET);
pci_set_word(pci_dev->wmask + offset + PCI_PM_CTRL,
PCI_PM_CTRL_STATE_MASK);
-
- return 0;
}
static int nvme_init_pci(NvmeCtrl *n, PCIDevice *pci_dev, Error **errp)
--
2.38.1
- [PATCH v8 00/17] pci: Abort if pci_add_capability fails, Akihiko Odaki, 2022/11/01
- [PATCH v8 02/17] pci: Allow to omit errp for pci_add_capability, Akihiko Odaki, 2022/11/01
- [PATCH v8 01/17] hw/vfio/pci: Ensure MSI and MSI-X do not overlap, Akihiko Odaki, 2022/11/01
- [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 <=
- [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, 2022/11/01
- [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