aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2013-01-25 14:12:35 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2013-02-01 15:53:10 -0600
commit62d7ba669dbd5b4c92664eea453d28448ab9cb4b (patch)
tree61a26431a8982d8c93a9f1c94cad8c10031148c6 /hw
parent06f7f2bb562826101468f387b4a34971b16e9aee (diff)
qdev: add reference for the bus while it is referred to by the DeviceState
Now that the unparent callbacks are complete, we can correctly account more missing references. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/qdev.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/hw/qdev.c b/hw/qdev.c
index 6f1b3117ff..1dabcad2a6 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -100,6 +100,7 @@ static void bus_add_child(BusState *bus, DeviceState *child)
void qdev_set_parent_bus(DeviceState *dev, BusState *bus)
{
dev->parent_bus = bus;
+ object_ref(OBJECT(bus));
bus_add_child(bus, dev);
}
@@ -773,6 +774,8 @@ static void device_unparent(Object *obj)
}
if (dev->parent_bus) {
bus_remove_child(dev->parent_bus, dev);
+ object_unref(OBJECT(dev->parent_bus));
+ dev->parent_bus = NULL;
}
}