diff mbox

[PULL,for-2.0-rc0,01/31] qdev: Fix bus dependency of DeviceState::hotpluggable getter

Message ID 1394658603-13650-2-git-send-email-afaerber@suse.de
State New
Headers show

Commit Message

Andreas Färber March 12, 2014, 9:09 p.m. UTC
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 <imammedo@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/core/qdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 380976a..5377893 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)