summary refs log tree commit diff stats
path: root/hw/core/qdev-hotplug.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/core/qdev-hotplug.c')
-rw-r--r--hw/core/qdev-hotplug.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/hw/core/qdev-hotplug.c b/hw/core/qdev-hotplug.c
index f6422cd0e4..ff176dc1bb 100644
--- a/hw/core/qdev-hotplug.c
+++ b/hw/core/qdev-hotplug.c
@@ -48,6 +48,16 @@ static bool qdev_hotplug_unplug_allowed_common(DeviceState *dev, BusState *bus,
                        bus->name);
             return false;
         }
+    } else {
+        if (!qdev_get_machine_hotplug_handler(dev)) {
+            /*
+             * No bus, no machine hotplug handler --> device is not hotpluggable
+             */
+            error_setg(errp,
+                       "Device '%s' can not be hotplugged on this machine",
+                       object_get_typename(OBJECT(dev)));
+            return false;
+        }
     }
 
     return true;