Nop rather than assert if a GPIO connection cannot be made. This
allows for continuation of machine init after an error which allows
removal of error detection boilerplate and detection of subsequent
errors.

The actual error (i.e. a GPIO endpoint was not inited) will have
already been raised by other APIs.

Ideally this API should raise an error in its own right. Add a FIXME.

Signed-off-by: Peter Crosthwaite <crosthwaite.pe...@gmail.com>
---

 hw/core/qdev.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index b2f404a..52140ba 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -467,7 +467,11 @@ qemu_irq qdev_get_gpio_in_named(DeviceState *dev, const 
char *name, int n)
 {
     NamedGPIOList *gpio_list = qdev_get_named_gpio_list(dev, name);
 
-    assert(n >= 0 && n < gpio_list->num_in);
+    assert(n >= 0);
+    if (n >= gpio_list->num_in) {
+        /* FIXME: add error ** to this API */
+        return NULL;
+    }
     return gpio_list->in[n];
 }
 
@@ -491,7 +495,8 @@ void qdev_connect_gpio_out_named(DeviceState *dev, const 
char *name, int n,
                                                 "/unattached"),
                                   "non-qdev-gpio[*]", OBJECT(pin), NULL);
     }
-    object_property_set_link(OBJECT(dev), OBJECT(pin), propname, &error_abort);
+    /* FIXME: add error ** to this API */
+    object_property_set_link(OBJECT(dev), OBJECT(pin), propname, NULL);
     g_free(propname);
 }
 
-- 
1.9.1


Reply via email to