Drop extra variable and extra function parameter passing, initialize dev._features directly.
Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]> --- hw/virtio/vhost.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index c990029756..d02d1d4c34 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -1557,18 +1557,17 @@ static void vhost_virtqueue_cleanup(struct vhost_virtqueue *vq) } } -static int vhost_dev_get_features(struct vhost_dev *hdev, - uint64_t *features) +static int vhost_dev_init_features(struct vhost_dev *hdev) { uint64_t features64; int r; if (hdev->vhost_ops->vhost_get_features_ex) { - return hdev->vhost_ops->vhost_get_features_ex(hdev, features); + return hdev->vhost_ops->vhost_get_features_ex(hdev, hdev->_features_ex); } r = hdev->vhost_ops->vhost_get_features(hdev, &features64); - virtio_features_from_u64(features, features64); + virtio_features_from_u64(hdev->_features_ex, features64); return r; } @@ -1615,7 +1614,6 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque, VhostBackendType backend_type, uint32_t busyloop_timeout, Error **errp) { - uint64_t features[VIRTIO_FEATURES_NU64S]; int i, r, n_initialized_vqs = 0; hdev->vdev = NULL; @@ -1635,9 +1633,9 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque, goto fail; } - r = vhost_dev_get_features(hdev, features); + r = vhost_dev_init_features(hdev); if (r < 0) { - error_setg_errno(errp, -r, "vhost_get_features failed"); + error_setg_errno(errp, -r, "vhost_init_features failed"); goto fail; } @@ -1650,8 +1648,6 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque, } } - virtio_features_copy(hdev->_features_ex, features); - hdev->memory_listener = (MemoryListener) { .name = "vhost", .begin = vhost_begin, -- 2.48.1
