aboutsummaryrefslogtreecommitdiff
path: root/hw/virtio-pci.c
diff options
context:
space:
mode:
authorAmit Shah <amit.shah@redhat.com>2011-07-27 12:29:33 +0530
committerAmit Shah <amit.shah@redhat.com>2011-07-28 15:10:19 +0530
commitab640dbfc04651ede92495a4067c826db068c1a7 (patch)
tree1272d8d1898846d8a16d61976e1d83f9439749e2 /hw/virtio-pci.c
parenteaa8b2778c182c8f795970dd46fef5b039fb741c (diff)
virtio-balloon: Check if balloon registration failed
Multiple balloon registrations are not allowed; check if the registration with the qemu balloon api succeeded. If not, fail the device init. Signed-off-by: Amit Shah <amit.shah@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/virtio-pci.c')
-rw-r--r--hw/virtio-pci.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index d685243728..ca5f125dae 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -788,6 +788,9 @@ static int virtio_balloon_init_pci(PCIDevice *pci_dev)
VirtIODevice *vdev;
vdev = virtio_balloon_init(&pci_dev->qdev);
+ if (!vdev) {
+ return -1;
+ }
virtio_init_pci(proxy, vdev);
return 0;
}