Commit 893bfc3c authored by Cao jin's avatar Cao jin Committed by Alex Williamson
Browse files

vfio: fix duplicate function call



When vfio device is reset(encounter FLR, or bus reset), if need to do
bus reset(vfio_pci_hot_reset_one is called), vfio_pci_pre_reset &
vfio_pci_post_reset will be called twice.

Signed-off-by: default avatarCao jin <caoj.fnst@cn.fujitsu.com>
Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
parent 31e6a7b1
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -1951,7 +1951,9 @@ static int vfio_pci_hot_reset(VFIOPCIDevice *vdev, bool single)

    trace_vfio_pci_hot_reset(vdev->vbasedev.name, single ? "one" : "multi");

    if (!single) {
        vfio_pci_pre_reset(vdev);
    }
    vdev->vbasedev.needs_reset = false;

    info = g_malloc0(sizeof(*info));
@@ -2109,7 +2111,9 @@ out:
        }
    }
out_single:
    if (!single) {
        vfio_pci_post_reset(vdev);
    }
    g_free(info);

    return ret;