summary refs log tree commit diff stats
path: root/hw/core
diff options
context:
space:
mode:
authorAkihiko Odaki <akihiko.odaki@daynix.com>2024-02-18 15:57:11 +0900
committerPhilippe Mathieu-Daudé <philmd@linaro.org>2025-01-13 17:16:03 +0100
commitccaca8929d53b23e2f7acc45cc88d05fc0479a1b (patch)
tree7179d8b11ea4fd7f8b7cfede06bdaa1c56b444dd /hw/core
parent1bff035be76cc30ff0fc4e8f0b0fbda84db7d1dc (diff)
downloadfocaccia-qemu-ccaca8929d53b23e2f7acc45cc88d05fc0479a1b.tar.gz
focaccia-qemu-ccaca8929d53b23e2f7acc45cc88d05fc0479a1b.zip
hw/qdev: Check qbus_is_hotpluggable in hotplug_unplug_allowed_common
Check the same code once in the common helper.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
[PMD: Split from bigger patch, part 5/6]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20250110091908.64454-6-philmd@linaro.org>
Diffstat (limited to 'hw/core')
-rw-r--r--hw/core/qdev-hotplug.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/hw/core/qdev-hotplug.c b/hw/core/qdev-hotplug.c
index 1d77fffb5e..f6422cd0e4 100644
--- a/hw/core/qdev-hotplug.c
+++ b/hw/core/qdev-hotplug.c
@@ -42,6 +42,14 @@ static bool qdev_hotplug_unplug_allowed_common(DeviceState *dev, BusState *bus,
         return false;
     }
 
+    if (bus) {
+        if (!qbus_is_hotpluggable(bus)) {
+            error_setg(errp, "Bus '%s' does not support hotplugging",
+                       bus->name);
+            return false;
+        }
+    }
+
     return true;
 }