On Sat, Dec 16, 2023 at 1:28 AM Eugenio Pérez <epere...@redhat.com> wrote:
>
> This makes easier to build an error path in next patches.  No functional
> change.
>
> Signed-off-by: Eugenio Pérez <epere...@redhat.com>

Acked-by: Jason Wang <jasow...@redhat.com>

Thanks

> ---
>  hw/virtio/vhost-vdpa.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
> index 57a8043cd4..449c3794b2 100644
> --- a/hw/virtio/vhost-vdpa.c
> +++ b/hw/virtio/vhost-vdpa.c
> @@ -1302,7 +1302,7 @@ static void vhost_vdpa_suspend(struct vhost_dev *dev)
>  static int vhost_vdpa_dev_start(struct vhost_dev *dev, bool started)
>  {
>      struct vhost_vdpa *v = dev->opaque;
> -    bool ok;
> +    bool ok = true;
>      trace_vhost_vdpa_dev_start(dev, started);
>
>      if (started) {
> @@ -1313,8 +1313,7 @@ static int vhost_vdpa_dev_start(struct vhost_dev *dev, 
> bool started)
>          }
>      } else {
>          vhost_vdpa_suspend(dev);
> -        vhost_vdpa_svqs_stop(dev);
> -        vhost_vdpa_host_notifiers_uninit(dev, dev->nvqs);
> +        goto out_stop;
>      }
>
>      if (dev->vq_index + dev->nvqs != dev->vq_index_end) {
> @@ -1333,6 +1332,11 @@ static int vhost_vdpa_dev_start(struct vhost_dev *dev, 
> bool started)
>      }
>
>      return 0;
> +
> +out_stop:
> +    vhost_vdpa_svqs_stop(dev);
> +    vhost_vdpa_host_notifiers_uninit(dev, dev->nvqs);
> +    return ok ? 0 : -1;
>  }
>
>  static void vhost_vdpa_reset_status(struct vhost_dev *dev)
> --
> 2.39.3
>


Reply via email to