On Thu, Jun 09 2022, Paolo Bonzini <pbonz...@redhat.com> wrote:

> All calls to virtio_bus_reset are preceded by virtio_bus_stop_ioeventfd,
> move the call in virtio_bus_reset: that makes sense and clarifies
> that the vdc->reset function is called with ioeventfd already stopped.
>
> Signed-off-by: Paolo Bonzini <pbonz...@redhat.com>
> ---
>  hw/s390x/virtio-ccw.c   | 1 -
>  hw/virtio/virtio-bus.c  | 1 +
>  hw/virtio/virtio-mmio.c | 4 +---
>  hw/virtio/virtio-pci.c  | 1 -
>  4 files changed, 2 insertions(+), 5 deletions(-)
>

(...)

> diff --git a/hw/virtio/virtio-bus.c b/hw/virtio/virtio-bus.c
> index d7ec023adf..896feb37a1 100644
> --- a/hw/virtio/virtio-bus.c
> +++ b/hw/virtio/virtio-bus.c
> @@ -104,6 +104,7 @@ void virtio_bus_reset(VirtioBusState *bus)
>      VirtIODevice *vdev = virtio_bus_get_device(bus);
>  
>      DPRINTF("%s: reset device.\n", BUS(bus)->name);
> +    virtio_bus_stop_ioeventfd(bus);
>      if (vdev != NULL) {
>          virtio_reset(vdev);

I looked at the code and I'm wondering under which conditions we could
arrive here with vdev == NULL... virtio_bus_stop_ioeventfd() assumes
that a vdev is there, at least if the ioeventfd has been started.

The patch looks correct, though.

Reviewed-by: Cornelia Huck <coh...@redhat.com>


Reply via email to