diff mbox series

[RFC,v3,15/20] hw/virtio: move vhost_user_init earlier

Message ID 20230710153522.3469097-16-alex.bennee@linaro.org
State New
Headers show
Series virtio: add vhost-user-generic, reduce c&p and support standalone | expand

Commit Message

Alex Bennée July 10, 2023, 3:35 p.m. UTC
In preparation for getting the details of the VirtIO device directly
from the vhost-user daemon we should connect once we have validated
the chardev. We will actually move the connection in the next patch to
keep the changes small and bisectable.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 hw/virtio/vhost-user-device.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/hw/virtio/vhost-user-device.c b/hw/virtio/vhost-user-device.c
index 2b028cae08..d787f52364 100644
--- a/hw/virtio/vhost-user-device.c
+++ b/hw/virtio/vhost-user-device.c
@@ -250,6 +250,10 @@  static void vub_device_realize(DeviceState *dev, Error **errp)
         return;
     }
 
+    if (!vhost_user_init(&vub->vhost_user, &vub->chardev, errp)) {
+        return;
+    }
+
     if (!vub->virtio_id) {
         error_setg(errp, "vhost-user-device: need to define device id");
         return;
@@ -268,10 +272,6 @@  static void vub_device_realize(DeviceState *dev, Error **errp)
         vub->vhost_user.supports_config = true;
     }
 
-    if (!vhost_user_init(&vub->vhost_user, &vub->chardev, errp)) {
-        return;
-    }
-
     virtio_init(vdev, vub->virtio_id, vub->config_size);
 
     /*