summary refs log tree commit diff stats
path: root/hw/virtio-console.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/virtio-console.c')
-rw-r--r--hw/virtio-console.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/hw/virtio-console.c b/hw/virtio-console.c
index b263281d8f..c006d90a95 100644
--- a/hw/virtio-console.c
+++ b/hw/virtio-console.c
@@ -126,14 +126,20 @@ static int virtio_console_load(QEMUFile *f, void *opaque, int version_id)
 void *virtio_console_init(PCIBus *bus, CharDriverState *chr)
 {
     VirtIOConsole *s;
+    PCIDevice *d;
 
-    s = (VirtIOConsole *)virtio_init_pci(bus, "virtio-console",
+    d = pci_register_device(bus, "virtio-console", sizeof(VirtIOConsole),
+                            -1, NULL, NULL);
+    if (!d)
+        return NULL;
+
+    s = (VirtIOConsole *)virtio_init_pci(d, "virtio-console",
                                          PCI_VENDOR_ID_REDHAT_QUMRANET,
                                          PCI_DEVICE_ID_VIRTIO_CONSOLE,
                                          PCI_VENDOR_ID_REDHAT_QUMRANET,
                                          VIRTIO_ID_CONSOLE,
                                          PCI_CLASS_DISPLAY_OTHER, 0x00,
-                                         0, sizeof(VirtIOConsole));
+                                         0);
     if (s == NULL)
         return NULL;