This is a temporary measure to allow mixing VirtioDeviceClass::init with DeviceClass::realize.
Clean up variable naming in preparation for QOM realize. Signed-off-by: Andreas Färber <afaer...@suse.de> --- hw/virtio/virtio.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 09f62c6..c00c224 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -1139,13 +1139,15 @@ void virtio_device_set_child_bus_name(VirtIODevice *vdev, char *bus_name) } } -static int virtio_device_init(DeviceState *qdev) +static int virtio_device_init(DeviceState *dev) { - VirtIODevice *vdev = VIRTIO_DEVICE(qdev); - VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(qdev); - assert(k->init != NULL); - if (k->init(vdev) < 0) { - return -1; + VirtIODevice *vdev = VIRTIO_DEVICE(dev); + VirtioDeviceClass *vdc = VIRTIO_DEVICE_GET_CLASS(dev); + + if (vdc->init != NULL) { + if (vdc->init(vdev) < 0) { + return -1; + } } virtio_bus_plug_device(vdev); return 0; -- 1.8.1.4