Skip to contentSkip to conversation

qom/object: Fix object_child_foreach_recursive() return value

PATCH In review Cédric Le Goater 3 participants 5 messages Apr 4, 2020 – May 8, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qom/object: Fix object_child_foreach_recursive() return value

When recursing, the return value of do_object_child_foreach() is not taken into account.

Cc Peter Crosthwaite <[email protected]>
Fixes d714b8de7747 ("qom: Add recursive version of object_child_for_each")
---
 qom/object.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
qom/object.c +4 -1
index 1812f792247d..b68a707a5e65 100644
@@ -1057,7 +1057,10 @@ static int do_object_child_foreach(Object *obj,
                 break;
             }
             if (recurse) {
-                do_object_child_foreach(child, fn, opaque, true);
+                ret = do_object_child_foreach(child, fn, opaque, true);
+                if (ret != 0) {
+                    break;
+                }
             }
         }
     }
Signature · 1 line
2.25.1
#1 lore raw

Hello David,

Quoted 2 lines · Cédric Le Goater

When recursing, the return value of do_object_child_foreach() is not taken into account.

Patch "ppc/pnv: Create BMC devices only when defaults are enabled" :

	http://patchwork.ozlabs.org/patch/1266421

depends on this fix.

May be it can go through the ppc branch ? A patchset with these two patches would have been easier to track :/ Sorry about that.

Thanks,

C.

Quoted 24 lines
Cc Peter Crosthwaite <[email protected]>
Fixes d714b8de7747 ("qom: Add recursive version of object_child_for_each")
---
 qom/object.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
qom/object.c +4 -1
index 1812f792247d..b68a707a5e65 100644
@@ -1057,7 +1057,10 @@ static int do_object_child_foreach(Object *obj,
                 break;
             }
             if (recurse) {
-                do_object_child_foreach(child, fn, opaque, true);
+                ret = do_object_child_foreach(child, fn, opaque, true);
+                if (ret != 0) {
+                    break;
+                }
             }
         }
     }
Reviewed-by on v1 1/1
#2 lore raw
In reply to Cédric Le Goater

Hi,

Quoted 7 lines · Cédric Le Goater

When recursing, the return value of do_object_child_foreach() is not taken into account.

Cc Peter Crosthwaite <[email protected]>
Fixes d714b8de7747 ("qom: Add recursive version of object_child_for_each")
Quoted 24 lines
---
 qom/object.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
qom/object.c +4 -2
index 1812f792247d..b68a707a5e65 100644
@@ -1057,7 +1057,10 @@ static int do_object_child_foreach(Object *obj,
                 break;
             }
             if (recurse) {
-                do_object_child_foreach(child, fn, opaque, true);
+                ret = do_object_child_foreach(child, fn, opaque, true);
+                if (ret != 0) {
+                    break;
+                }
             }
         }
     }
--

2.25.1

Signature · 1 line
Marc-André Lureau
#3 lore raw
In reply to Cédric Le Goater

Hello,

Quoted 6 lines · Cédric Le Goater

When recursing, the return value of do_object_child_foreach() is not taken into account.

Cc Peter Crosthwaite <[email protected]>
Fixes d714b8de7747 ("qom: Add recursive version of object_child_for_each")

What are the plans to merge this one ?

Thanks,
C.

Quoted 21 lines
---
 qom/object.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
qom/object.c +4 -1
index 1812f792247d..b68a707a5e65 100644
@@ -1057,7 +1057,10 @@ static int do_object_child_foreach(Object *obj,
                 break;
             }
             if (recurse) {
-                do_object_child_foreach(child, fn, opaque, true);
+                ret = do_object_child_foreach(child, fn, opaque, true);
+                if (ret != 0) {
+                    break;
+                }
             }
         }
     }
Reviewed-by on v1 1/1
#4 lore raw
In reply to Cédric Le Goater
Quoted 5 lines · Cédric Le Goater

When recursing, the return value of do_object_child_foreach() is not taken into account.

Cc Peter Crosthwaite <[email protected]>
Fixes d714b8de7747 ("qom: Add recursive version of object_child_for_each")

Indeed.

Quoted 22 lines
---
  qom/object.c | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
qom/object.c +4 -1
index 1812f792247d..b68a707a5e65 100644
@@ -1057,7 +1057,10 @@ static int do_object_child_foreach(Object *obj,
                  break;
              }
              if (recurse) {
-                do_object_child_foreach(child, fn, opaque, true);
+                ret = do_object_child_foreach(child, fn, opaque, true);
+                if (ret != 0) {
+                    break;
+                }
              }
          }
      }