From ccaca8929d53b23e2f7acc45cc88d05fc0479a1b Mon Sep 17 00:00:00 2001 From: Akihiko Odaki Date: Sun, 18 Feb 2024 15:57:11 +0900 Subject: hw/qdev: Check qbus_is_hotpluggable in hotplug_unplug_allowed_common MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Check the same code once in the common helper. Signed-off-by: Akihiko Odaki [PMD: Split from bigger patch, part 5/6] Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Igor Mammedov Message-Id: <20250110091908.64454-6-philmd@linaro.org> --- hw/core/qdev-hotplug.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'hw/core/qdev-hotplug.c') 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; } -- cgit 1.4.1