Patchwork qdev: don't ref parent bus

login
register
mail settings
Submitter Hu Tao
Date April 8, 2013, 10:16 a.m.
Message ID <1365416173-30073-1-git-send-email-hutao@cn.fujitsu.com>
Download mbox | patch
Permalink /patch/234721/
State New
Headers show

Comments

Hu Tao - April 8, 2013, 10:16 a.m.
Since bus refs its children, it introduces reference cycle when qdev
refs its parent bus.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
---
 hw/qdev.c | 2 --
 1 file changed, 2 deletions(-)

Patch

diff --git a/hw/qdev.c b/hw/qdev.c
index e2bb37d..c84bffb 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -103,7 +103,6 @@  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);
 }
 
@@ -783,7 +782,6 @@  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;
     }