From 2b81b35f8f18d6874d1a0605ac5e40028966051b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Fri, 7 Mar 2014 19:04:13 +0100 Subject: qdev: Fix bus dependency of DeviceState::hotpluggable getter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit 1a37eca107cece3ed454bae29eef0bd1fac4a244 (qdev: add "hotpluggable" property to Device) added a property "hotpluggable" to each device, with its getter accessing parent_bus->allow_hotplug. Add a NULL check. Cc: Igor Mammedov Signed-off-by: Andreas Färber --- hw/core/qdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'hw/core/qdev.c') diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 380976a066..53778938e6 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -735,7 +735,8 @@ static bool device_get_hotpluggable(Object *obj, Error **err) DeviceClass *dc = DEVICE_GET_CLASS(obj); DeviceState *dev = DEVICE(obj); - return dc->hotpluggable && dev->parent_bus->allow_hotplug; + return dc->hotpluggable && (dev->parent_bus == NULL || + dev->parent_bus->allow_hotplug); } static void device_initfn(Object *obj) -- cgit v1.2.1