virtio-pci: Check for virtio_blk_init() failure
authorMarkus Armbruster <armbru@redhat.com>
Tue, 6 Jul 2010 12:37:42 +0000 (14:37 +0200)
committerKevin Wolf <kwolf@redhat.com>
Tue, 13 Jul 2010 15:48:17 +0000 (17:48 +0200)
It can't actually fail now, but the next commit will change that.

s390_virtio_blk_init() already checks for failure, but
virtio_blk_init_pci() doesn't.  Fix that.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
hw/virtio-pci.c

index c728fff..5583166 100644 (file)
@@ -551,6 +551,9 @@ static int virtio_blk_init_pci(PCIDevice *pci_dev)
         return -1;
     }
     vdev = virtio_blk_init(&pci_dev->qdev, &proxy->block);
+    if (!vdev) {
+        return -1;
+    }
     vdev->nvectors = proxy->nvectors;
     virtio_init_pci(proxy, vdev,
                     PCI_VENDOR_ID_REDHAT_QUMRANET,