Drop extra variable and extra function parameter passing, initialize dev._features directly.
Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]> Reviewed-by: Daniil Tatianin <[email protected]> Reviewed-by: Raphael Norwitz <[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 b9f26a4ee8..ad49b9cc2f 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -1561,18 +1561,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; } @@ -1580,7 +1579,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]; unsigned int used, reserved, limit; int i, r, n_initialized_vqs = 0; @@ -1601,9 +1599,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; } @@ -1629,8 +1627,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.52.0
