Patchwork [2/2] virtio-pci: return error if virtio_console_init fails

login
register
mail settings
Submitter Amit Shah
Date Sept. 29, 2009, 10:21 a.m.
Message ID <1254219664-7437-2-git-send-email-amit.shah@redhat.com>
Download mbox | patch
Permalink /patch/34417/
State Superseded
Headers show

Comments

Amit Shah - Sept. 29, 2009, 10:21 a.m.
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>
---
 hw/virtio-pci.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

Patch

diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index bd5a7c4..66967c6 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -470,6 +470,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,