@@ -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)
This makes easier to build an error path in next patches. No functional change. Signed-off-by: Eugenio PĂ©rez <eperezma@redhat.com> --- hw/virtio/vhost-vdpa.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)