From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:56438) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qrb7X-0003Fw-R0 for qemu-devel@nongnu.org; Thu, 11 Aug 2011 15:40:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qrb7W-0000p9-NF for qemu-devel@nongnu.org; Thu, 11 Aug 2011 15:40:47 -0400 Received: from e39.co.us.ibm.com ([32.97.110.160]:56192) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qrb7W-0000oq-FO for qemu-devel@nongnu.org; Thu, 11 Aug 2011 15:40:46 -0400 Received: from d03relay01.boulder.ibm.com (d03relay01.boulder.ibm.com [9.17.195.226]) by e39.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id p7BJPbZg015229 for ; Thu, 11 Aug 2011 13:25:37 -0600 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay01.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p7BJedDc100860 for ; Thu, 11 Aug 2011 13:40:40 -0600 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p7BDeCqu019378 for ; Thu, 11 Aug 2011 07:40:12 -0600 Message-ID: <4E443036.7010908@us.ibm.com> Date: Thu, 11 Aug 2011 14:40:38 -0500 From: Anthony Liguori MIME-Version: 1.0 References: <1312776932-15081-1-git-send-email-wuzhy@linux.vnet.ibm.com> In-Reply-To: <1312776932-15081-1-git-send-email-wuzhy@linux.vnet.ibm.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] qdev: Remove some non-run codes in qdev_walk_children(). List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Zhi Yong Wu Cc: stefanha@linux.vnet.ibm.com, armbru@redhat.com, qemu-devel@nongnu.org, zwu.kernel@gmail.com, ryanh@us.ibm.com, luowenj@cn.ibm.com On 08/07/2011 11:15 PM, Zhi Yong Wu wrote: > As you have known, qdev_reset_one() forever return a ZERO value to its caller, so some branches can not be forever covered in qdev_walk_children(). > > I thought that the return value for dev->info->reset(dev) can be returned, but dev->info->reset(dev) is referring to a function with void type. > > Signed-off-by: Zhi Yong Wu But the details of qdev_reset_one are irrelevant to qdev_walk_children(). There may be other functions that want to walk the tree and it's useful to be able to interrupt the tree transversal by returning a non-zero value. Regards, Anthony Liguori > --- > hw/qdev.c | 5 +---- > 1 files changed, 1 insertions(+), 4 deletions(-) > > diff --git a/hw/qdev.c b/hw/qdev.c > index 292b52f..cbc5e02 100644 > --- a/hw/qdev.c > +++ b/hw/qdev.c > @@ -513,10 +513,7 @@ int qdev_walk_children(DeviceState *dev, qdev_walkerfn *devfn, > int err; > > if (devfn) { > - err = devfn(dev, opaque); > - if (err) { > - return err; > - } > + devfn(dev, opaque); > } > > QLIST_FOREACH(bus,&dev->child_bus, sibling) {