summaryrefslogtreecommitdiff
path: root/hw/pci-hotplug.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/pci-hotplug.c')
-rw-r--r--hw/pci-hotplug.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/hw/pci-hotplug.c b/hw/pci-hotplug.c
index d7431929ab..fe468d646e 100644
--- a/hw/pci-hotplug.c
+++ b/hw/pci-hotplug.c
@@ -214,7 +214,11 @@ static PCIDevice *qemu_pci_hot_add_storage(Monitor *mon,
return NULL;
}
dev = pci_create(bus, devfn, "virtio-blk-pci");
- qdev_prop_set_drive(&dev->qdev, "drive", dinfo->bdrv);
+ if (qdev_prop_set_drive(&dev->qdev, "drive", dinfo->bdrv) < 0) {
+ qdev_free(&dev->qdev);
+ dev = NULL;
+ break;
+ }
if (qdev_init(&dev->qdev) < 0)
dev = NULL;
break;