[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 04/21] pci: Clean up error checking in pci_add_capabi
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL 04/21] pci: Clean up error checking in pci_add_capability() |
Date: |
Mon, 3 Jul 2017 22:44:40 +0300 |
From: Mao Zhongyi <address@hidden>
On success, pci_add_capability2() returns a positive value. On
failure, it sets an error and return a negative value.
pci_add_capability() laboriously checks this behavior. No other
caller does. Drop the checks from pci_add_capability().
Cc: address@hidden
Cc: address@hidden
Signed-off-by: Mao Zhongyi <address@hidden>
Reviewed-by: Marcel Apfelbaum <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
hw/pci/pci.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index b7fee4b..3c24888 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -2270,12 +2270,8 @@ int pci_add_capability(PCIDevice *pdev, uint8_t cap_id,
Error *local_err = NULL;
ret = pci_add_capability2(pdev, cap_id, offset, size, &local_err);
- if (local_err) {
- assert(ret < 0);
+ if (ret < 0) {
error_report_err(local_err);
- } else {
- /* success implies a positive offset in config space */
- assert(ret > 0);
}
return ret;
}
--
MST
- [Qemu-devel] [PULL 00/21] pc, acpi, pci, virtio: fixes, cleanups, features, tests, Michael S. Tsirkin, 2017/07/03
- [Qemu-devel] [PULL 01/21] virtio-net: enable configurable tx queue size, Michael S. Tsirkin, 2017/07/03
- [Qemu-devel] [PULL 02/21] hw/pci-bridge/dec: Classify the DEC PCI bridge as bridge device, Michael S. Tsirkin, 2017/07/03
- [Qemu-devel] [PULL 03/21] intel_iommu: relax iq tail check on VTD_GCMD_QIE enable, Michael S. Tsirkin, 2017/07/03
- [Qemu-devel] [PULL 04/21] pci: Clean up error checking in pci_add_capability(),
Michael S. Tsirkin <=
- [Qemu-devel] [PULL 05/21] pci: Add comment for pci_add_capability2(), Michael S. Tsirkin, 2017/07/03
- [Qemu-devel] [PULL 06/21] pci: Fix the wrong assertion., Michael S. Tsirkin, 2017/07/03
- [Qemu-devel] [PULL 07/21] pci: Make errp the last parameter of pci_add_capability(), Michael S. Tsirkin, 2017/07/03
- [Qemu-devel] [PULL 08/21] pci: Replace pci_add_capability2() with pci_add_capability(), Michael S. Tsirkin, 2017/07/03
- [Qemu-devel] [PULL 09/21] pci: Convert to realize, Michael S. Tsirkin, 2017/07/03
- [Qemu-devel] [PULL 10/21] pci: Convert shpc_init() to Error, Michael S. Tsirkin, 2017/07/03
- [Qemu-devel] [PULL 11/21] i386/kvm/pci-assign: Fix return type of verify_irqchip_kernel(), Michael S. Tsirkin, 2017/07/03
- [Qemu-devel] [PULL 12/21] i386/kvm/pci-assign: Use errp directly rather than local_err, Michael S. Tsirkin, 2017/07/03
- [Qemu-devel] [PULL 15/21] hw/acpi: remove dead acpi code, Michael S. Tsirkin, 2017/07/03
- [Qemu-devel] [PULL 14/21] fw_cfg: move setting of FW_CFG_VERSION_DMA bit to fw_cfg_init1(), Michael S. Tsirkin, 2017/07/03