virtio-pci: return error if virtio_console_init fails
authorAmit Shah <amit.shah@redhat.com>
Tue, 29 Sep 2009 10:21:04 +0000 (15:51 +0530)
committerAnthony Liguori <aliguori@us.ibm.com>
Mon, 5 Oct 2009 14:32:53 +0000 (09:32 -0500)
Currently only one virtio_console device is supported. Trying to add
multiple devices fails and such failure should be reported back to the
qdev init functions.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
hw/virtio-pci.c

index 5c976296e3f4d201d6e6732eda6bea1b0f5c7740..01782e5807f53c107fdc9974343fac8fbea460b4 100644 (file)
@@ -473,6 +473,9 @@ static int virtio_console_init_pci(PCIDevice *pci_dev)
         proxy->class_code = PCI_CLASS_COMMUNICATION_OTHER;
 
     vdev = virtio_console_init(&pci_dev->qdev);
+    if (!vdev) {
+        return -1;
+    }
     virtio_init_pci(proxy, vdev,
                     PCI_VENDOR_ID_REDHAT_QUMRANET,
                     PCI_DEVICE_ID_VIRTIO_CONSOLE,