From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55550) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aB2iL-0005G9-OJ for qemu-devel@nongnu.org; Mon, 21 Dec 2015 10:49:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aB2iG-0001qX-GY for qemu-devel@nongnu.org; Mon, 21 Dec 2015 10:49:33 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51795) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aB2iG-0001qL-Bi for qemu-devel@nongnu.org; Mon, 21 Dec 2015 10:49:28 -0500 References: <1450436632-23980-1-git-send-email-caoj.fnst@cn.fujitsu.com> <1450436632-23980-4-git-send-email-caoj.fnst@cn.fujitsu.com> <56744A11.3030405@redhat.com> <56769336.9050104@cn.fujitsu.com> From: Paolo Bonzini Message-ID: <56781F82.3060603@redhat.com> Date: Mon, 21 Dec 2015 16:49:22 +0100 MIME-Version: 1.0 In-Reply-To: <56769336.9050104@cn.fujitsu.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 3/5] PXB: convert to realize() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cao jin , qemu-devel@nongnu.org Cc: mst@redhat.com, leon.alrae@imgtec.com, ehabkost@redhat.com, aurelien@aurel32.net, rth@twiddle.net On 20/12/2015 12:38, Cao jin wrote: >>> >>> + object_unref(OBJECT(ds)); >>> + object_unref(OBJECT(bds)); >>> + object_unref(OBJECT(bus)); >> >> I think these should be object_unparent, not unref. >> >=20 > But, it seems these 3 objects isn`t added as a child-property via > object_property_add_child() during creation, so OBJECT(ds)->parent(so > does the other 2) will be NULL, and so object_unparent will do nothing? qdev_init_nofail adds them (qdev_init_nofail -> object_property_set_bool -> device_set_realized -> object_property_add_child). If you haven't reached qdev_init_nofail, you should indeed unref ds and bds instead. However, the bus should be unparented because pci_bus_new makes it a child of ds (pci_bus_new -> qbus_create -> qbus_realize -> object_property_add_child). Paolo