Skip to contentSkip to conversation

Two small QOM fixes

PATCH Applied Paolo Bonzini 4 participants 8 messages Feb 28, 2012 – Mar 13, 2012

lore
Share & tools
lore
#0 lore raw

cover Two small QOM fixes

Two fixes for bugs that were reported on the list.

Paolo Bonzini (2):
qdev: accept empty string properties
qom: fix device hot-unplug

 hw/qdev-properties.c |    4 ----
 qom/object.c         |    7 ++-----
 2 files changed, 2 insertions(+), 9 deletions(-)
Signature · 1 line
1.7.7.6
#1 lore raw

PATCH 1/2 qdev: accept empty string properties

These were stored as NULL due to wrong cut-and-paste from set_pointer.

---
 hw/qdev-properties.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)
hw/qdev-properties.c +0 -4
index 0423af1..bff9152 100644
@@ -421,10 +421,6 @@ static void set_string(Object *obj, Visitor *v, void *opaque,
         error_propagate(errp, local_err);
         return;
     }
-    if (!*str) {
-        g_free(str);
-        str = NULL;
-    }
     if (*ptr) {
         g_free(*ptr);
     }
Signature · 1 line
1.7.7.6
Tested-by on v1 1/2
#2 lore raw

Re: [Qemu-devel] [PATCH 1/2] qdev: accept empty string properties

Works well,

Ciao,
Gerhard

--
http://www.wiesinger.com/

Quoted 28 lines · Paolo Bonzini

These were stored as NULL due to wrong cut-and-paste from set_pointer.

---
hw/qdev-properties.c | 4 ----

1 files changed, 0 insertions(+), 4 deletions(-)
hw/qdev-properties.c +0 -4
index 0423af1..bff9152 100644
@@ -421,10 +421,6 @@ static void set_string(Object *obj, Visitor *v, void *opaque,
        error_propagate(errp, local_err);
        return;
    }
-    if (!*str) {
-        g_free(str);
-        str = NULL;
-    }
    if (*ptr) {
        g_free(*ptr);
    }
Signature · 1 line
1.7.7.6
Reviewed-by on v1 1/2
#3 lore raw

Re: [Qemu-devel] [PATCH 1/2] qdev: accept empty string properties

In reply to Paolo Bonzini

Am 28.02.2012 09:54, schrieb Paolo Bonzini:

Quoted 4 lines

These were stored as NULL due to wrong cut-and-paste from set_pointer.

/-F

Quoted 19 lines
---
 hw/qdev-properties.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)
hw/qdev-properties.c +0 -4
index 0423af1..bff9152 100644
@@ -421,10 +421,6 @@ static void set_string(Object *obj, Visitor *v, void *opaque,
         error_propagate(errp, local_err);
         return;
     }
-    if (!*str) {
-        g_free(str);
-        str = NULL;
-    }
     if (*ptr) {
         g_free(*ptr);
     }
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#4 lore raw

PATCH 2/2 qom: fix device hot-unplug

In reply to Paolo Bonzini

Property removal modifies the list, so it is not safe to continue iteration. We know anyway that each object can have only one parent (see object_property_add_child), so exit after finding the requested object.

---
 qom/object.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
qom/object.c +2 -5
index aa037d2..39cbcb9 100644
@@ -304,12 +304,9 @@ static void object_property_del_child(Object *obj, Object *child, Error **errp)
     ObjectProperty *prop;
 
     QTAILQ_FOREACH(prop, &obj->properties, node) {
-        if (!strstart(prop->type, "child<", NULL)) {
-            continue;
-        }
-
-        if (prop->opaque == child) {
+        if (strstart(prop->type, "child<", NULL) && prop->opaque == child) {
             object_property_del(obj, prop->name, errp);
+            break;
         }
     }
 }
Signature · 1 line
1.7.7.6
#5 lore raw

Re: [Qemu-devel] [PATCH 2/2] qom: fix device hot-unplug

Am 28.02.2012 09:54, schrieb Paolo Bonzini:

Quoted 16 lines

Property removal modifies the list, so it is not safe to continue iteration. We know anyway that each object can have only one parent (see object_property_add_child), so exit after finding the requested object.

---
 qom/object.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
qom/object.c +0 -0
index aa037d2..39cbcb9 100644

qom/object.c static void object_property_del_child(Object *obj, Object *child, Error **errp) · line 307

Quoted 9 lines
qom/object.c +1 -5
@@ -304,12 +304,9 @@ static void object_property_del_child(Object *obj, Object *child, Error **errp)
     ObjectProperty *prop;
 
     QTAILQ_FOREACH(prop, &obj->properties, node) {
-        if (!strstart(prop->type, "child<", NULL)) {
-            continue;
-        }
-
-        if (prop->opaque == child) {
+        if (strstart(prop->type, "child<", NULL) && prop->opaque == child) {

Didn't someone post a patch introducing an object_property_is_child() or so? Would be handy here.

Otherwise looks okay.

Andreas

Quoted 5 lines
qom/object.c +1 -0
             object_property_del(obj, prop->name, errp);
+            break;
         }
     }
 }
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#6 lore raw
In reply to Paolo Bonzini

Il 28/02/2012 09:54, Paolo Bonzini ha scritto:

Quoted 10 lines

Two fixes for bugs that were reported on the list.

Paolo Bonzini (2):
qdev: accept empty string properties
qom: fix device hot-unplug

 hw/qdev-properties.c |    4 ----
 qom/object.c         |    7 ++-----
 2 files changed, 2 insertions(+), 9 deletions(-)

Ping.

Paolo

#7 lore raw
In reply to Paolo Bonzini
Quoted 1 line · Paolo Bonzini

Two fixes for bugs that were reported on the list.

Applied. Thanks.

Regards,

Anthony Liguori

Quoted 9 lines

Paolo Bonzini (2):
qdev: accept empty string properties
qom: fix device hot-unplug

  hw/qdev-properties.c |    4 ----
  qom/object.c         |    7 ++-----
  2 files changed, 2 insertions(+), 9 deletions(-)