Patchwork xilinx_axienet.c: Assert no error when making link

login
register
mail settings
Submitter Peter Crosthwaite
Date Feb. 11, 2013, 7:16 a.m.
Message ID <0c6a908b-571a-4573-b175-47f760f22135@CH1EHSMHS010.ehs.local>
Download mbox | patch
Permalink /patch/219542/
State New
Headers show

Comments

Peter Crosthwaite - Feb. 11, 2013, 7:16 a.m.
This gives an awful silent failure when it doesn't work. Assert against link
creation failure.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---
 hw/xilinx_axienet.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
Stefan Hajnoczi - Feb. 13, 2013, 8:55 a.m.
On Mon, Feb 11, 2013 at 05:16:05PM +1000, Peter Crosthwaite wrote:
> This gives an awful silent failure when it doesn't work. Assert against link
> creation failure.
> 
> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> ---
>  hw/xilinx_axienet.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)

Thanks, applied to the trivial patches -next tree:
https://github.com/stefanha/qemu/commits/trivial-patches-next

Stefan

Patch

diff --git a/hw/xilinx_axienet.c b/hw/xilinx_axienet.c
index 34e344c..e5d9251 100644
--- a/hw/xilinx_axienet.c
+++ b/hw/xilinx_axienet.c
@@ -869,9 +869,11 @@  static int xilinx_enet_init(SysBusDevice *dev)
 static void xilinx_enet_initfn(Object *obj)
 {
     struct XilinxAXIEnet *s = FROM_SYSBUS(typeof(*s), SYS_BUS_DEVICE(obj));
+    Error *errp = NULL;
 
     object_property_add_link(obj, "axistream-connected", TYPE_STREAM_SLAVE,
-                             (Object **) &s->tx_dev, NULL);
+                             (Object **) &s->tx_dev, &errp);
+    assert_no_error(errp);
 }
 
 static Property xilinx_enet_properties[] = {