From: Peter Crosthwaite <peter.crosthwa...@xilinx.com>

By passing in "" to object_property_set_link.

The lead user of this is the QDEV GPIO framework which will implement
GPIO disconnects via an "unlink".  GPIO disconnection is used by
qtest's irq_intercept_out command.

Reviewed-by: Alexander Graf <ag...@suse.de>
Signed-off-by: Peter Crosthwaite <peter.crosthwa...@xilinx.com>
Signed-off-by: Paolo Bonzini <pbonz...@redhat.com>
---
 qom/object.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/qom/object.c b/qom/object.c
index a751367..c7ef776 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -872,9 +872,13 @@ char *object_property_get_str(Object *obj, const char 
*name,
 void object_property_set_link(Object *obj, Object *value,
                               const char *name, Error **errp)
 {
-    gchar *path = object_get_canonical_path(value);
-    object_property_set_str(obj, path, name, errp);
-    g_free(path);
+    if (value) {
+        gchar *path = object_get_canonical_path(value);
+        object_property_set_str(obj, path, name, errp);
+        g_free(path);
+    } else {
+        object_property_set_str(obj, "", name, errp);
+    }
 }
 
 Object *object_property_get_link(Object *obj, const char *name,
-- 
1.8.3.1



Reply via email to