[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 55/63] pcie_sriov: unregister_vfs(): fix error path
|
From: |
Michael S. Tsirkin |
|
Subject: |
[PULL 55/63] pcie_sriov: unregister_vfs(): fix error path |
|
Date: |
Wed, 4 Oct 2023 04:46:06 -0400 |
From: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
local_err must be NULL before calling object_property_set_bool(), so we
must clear it on each iteration. Let's also use more convenient
error_reportf_err().
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Message-Id: <20230925194040.68592-8-vsementsov@yandex-team.ru>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/pci/pcie_sriov.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c
index 76a3b6917e..5ef8950940 100644
--- a/hw/pci/pcie_sriov.c
+++ b/hw/pci/pcie_sriov.c
@@ -196,19 +196,16 @@ static void register_vfs(PCIDevice *dev)
static void unregister_vfs(PCIDevice *dev)
{
- Error *local_err = NULL;
uint16_t num_vfs = dev->exp.sriov_pf.num_vfs;
uint16_t i;
trace_sriov_unregister_vfs(dev->name, PCI_SLOT(dev->devfn),
PCI_FUNC(dev->devfn), num_vfs);
for (i = 0; i < num_vfs; i++) {
+ Error *err = NULL;
PCIDevice *vf = dev->exp.sriov_pf.vf[i];
- object_property_set_bool(OBJECT(vf), "realized", false, &local_err);
- if (local_err) {
- fprintf(stderr, "Failed to unplug: %s\n",
- error_get_pretty(local_err));
- error_free(local_err);
+ if (!object_property_set_bool(OBJECT(vf), "realized", false, &err)) {
+ error_reportf_err(err, "Failed to unplug: ");
}
object_unparent(OBJECT(vf));
object_unref(OBJECT(vf));
--
MST
[PULL 35/63] hw/i386/acpi-build: Use pc_madt_cpu_entry() directly, Michael S. Tsirkin, 2023/10/04
[PULL 42/63] hw/acpi/core: Trace enable and status registers of GPE separately, Michael S. Tsirkin, 2023/10/04
[PULL 48/63] hw/cxl: Support 4 HDM decoders at all levels of topology, Michael S. Tsirkin, 2023/10/04
[PULL 51/63] vdpa net: stop probing if cannot set features, Michael S. Tsirkin, 2023/10/04
[PULL 55/63] pcie_sriov: unregister_vfs(): fix error path,
Michael S. Tsirkin <=
[PULL 47/63] hw/cxl: Fix and use same calculation for HDM decoder block size everywhere, Michael S. Tsirkin, 2023/10/04
[PULL 45/63] hw/cxl: Push cxl_decoder_count_enc() and cxl_decode_ig() into .c, Michael S. Tsirkin, 2023/10/04
[PULL 60/63] util/uuid: add a hash function, Michael S. Tsirkin, 2023/10/04
[PULL 53/63] amd_iommu: Fix APIC address check, Michael S. Tsirkin, 2023/10/04
[PULL 56/63] libvhost-user.c: add assertion to vu_message_read_default, Michael S. Tsirkin, 2023/10/04
[PULL 61/63] hw/display: introduce virtio-dmabuf, Michael S. Tsirkin, 2023/10/04
[PULL 57/63] virtio: use shadow_avail_idx while checking number of heads, Michael S. Tsirkin, 2023/10/04
[PULL 40/63] hw/i386/acpi-build: Determine SMI command port just once, Michael S. Tsirkin, 2023/10/04
[PULL 46/63] hw/cxl: Add utility functions decoder interleave ways and target count., Michael S. Tsirkin, 2023/10/04
[PULL 54/63] hw/i386/pc: improve physical address space bound check for 32-bit x86 systems, Michael S. Tsirkin, 2023/10/04