summary refs log tree commit diff stats
path: root/hw/virtio-balloon.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/virtio-balloon.c')
-rw-r--r--hw/virtio-balloon.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/hw/virtio-balloon.c b/hw/virtio-balloon.c
index 079f49890d..b8f9184e11 100644
--- a/hw/virtio-balloon.c
+++ b/hw/virtio-balloon.c
@@ -172,16 +172,20 @@ static int virtio_balloon_load(QEMUFile *f, void *opaque, int version_id)
 void *virtio_balloon_init(PCIBus *bus)
 {
     VirtIOBalloon *s;
+    PCIDevice *d;
 
-    s = (VirtIOBalloon *)virtio_init_pci(bus, "virtio-balloon",
+    d = pci_register_device(bus, "virtio-balloon", sizeof(VirtIOBalloon),
+                            -1, NULL, NULL);
+    if (!d)
+        return NULL;
+
+    s = (VirtIOBalloon *)virtio_init_pci(d, "virtio-balloon",
                                          PCI_VENDOR_ID_REDHAT_QUMRANET,
                                          PCI_DEVICE_ID_VIRTIO_BALLOON,
                                          PCI_VENDOR_ID_REDHAT_QUMRANET,
                                          VIRTIO_ID_BALLOON,
                                          PCI_CLASS_MEMORY_RAM, 0x00,
-                                         8, sizeof(VirtIOBalloon));
-    if (s == NULL)
-        return NULL;
+                                         8);
 
     s->vdev.get_config = virtio_balloon_get_config;
     s->vdev.set_config = virtio_balloon_set_config;