qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] qdev: Remove some non-run codes in qdev_walk_ch


From: Anthony Liguori
Subject: Re: [Qemu-devel] [PATCH] qdev: Remove some non-run codes in qdev_walk_children().
Date: Thu, 11 Aug 2011 14:40:38 -0500
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110516 Lightning/1.0b2 Thunderbird/3.1.10

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<address@hidden>

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) {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]