]> git.proxmox.com Git - mirror_qemu.git/blobdiff - qdev-monitor.c
Merge remote-tracking branch 'remotes/kraxel/tags/ati-20190919-pull-request' into...
[mirror_qemu.git] / qdev-monitor.c
index 8fe5c2cad25cab903eeb0a3b14f20b8c7264da50..148df9cacfe319e4d9cd46c918b6e2fa67dae4d0 100644 (file)
@@ -615,6 +615,13 @@ DeviceState *qdev_device_add(QemuOpts *opts, Error **errp)
     /* create device */
     dev = DEVICE(object_new(driver));
 
+    /* Check whether the hotplug is allowed by the machine */
+    if (qdev_hotplug && !qdev_hotplug_allowed(dev, &err)) {
+        /* Error must be set in the machine hook */
+        assert(err);
+        goto err_del_dev;
+    }
+
     if (bus) {
         qdev_set_parent_bus(dev, bus);
     } else if (qdev_hotplug && !qdev_get_machine_hotplug_handler(dev)) {