Two small QOM fixes
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
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
@@ -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
Re: [Qemu-devel] [PATCH 1/2] qdev: accept empty string properties
Works well,
Ciao,
Gerhard
Quoted 28 lines · Paolo Bonzini
These were stored as NULL due to wrong cut-and-paste from
set_pointer.Reported-by Gerhard Wiesinger <[email protected]>Signed-off-by Paolo Bonzini <[email protected]>---
hw/qdev-properties.c| 4 ----1 files changed, 0 insertions(+), 4 deletions(-)hw/qdev-properties.c +0
-4@@ -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
Re: [Qemu-devel] [PATCH 1/2] qdev: accept empty string properties
In reply to Paolo BonziniAm 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.Reported-by Gerhard Wiesinger <[email protected]>Signed-off-by Paolo Bonzini <[email protected]>
/-F
Quoted 19 lines
--- hw/qdev-properties.c | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-)hw/qdev-properties.c +0
-4@@ -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
PATCH 2/2 qom: fix device hot-unplug
In reply to Paolo BonziniProperty 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
@@ -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
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.Reported-by Michael S. Tsirkin <[email protected]>Signed-off-by Paolo Bonzini <[email protected]>--- qom/object.c | 7 ++----- 1 files changed, 2 insertions(+), 5 deletions(-)qom/object.c +0
-0
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
-0object_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
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-unplughw/qdev-properties.c | 4 ---- qom/object.c | 7 ++----- 2 files changed, 2 insertions(+), 9 deletions(-)
Ping.
Paolo
Anthony Liguori
AppliedQuoted 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-unplughw/qdev-properties.c | 4 ---- qom/object.c | 7 ++----- 2 files changed, 2 insertions(+), 9 deletions(-)