Blame 0207-xilinx.h-Error-check-when-setting-links.patch

5544c1
From bfec52da020f35304f4e059bf4725fe01dbdd154 Mon Sep 17 00:00:00 2001
5544c1
From: "Peter A. G. Crosthwaite" <peter.crosthwaite@petalogix.com>
5544c1
Date: Mon, 17 Sep 2012 13:41:39 +1000
5544c1
Subject: [PATCH] xilinx.h: Error check when setting links
5544c1
5544c1
Assert that the ethernet and dma controller are sucessfully linked to their
5544c1
peers.
5544c1
5544c1
Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
5544c1
(cherry picked from commit 4b5e52101f9ad077d1c016f2b7130e2fdae6d2da)
5544c1
5544c1
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
5544c1
---
5544c1
 hw/xilinx.h | 10 ++++++++--
5544c1
 1 file changed, 8 insertions(+), 2 deletions(-)
5544c1
5544c1
diff --git a/hw/xilinx.h b/hw/xilinx.h
5544c1
index df06a00..35d6681 100644
5544c1
--- a/hw/xilinx.h
5544c1
+++ b/hw/xilinx.h
5544c1
@@ -55,13 +55,16 @@ xilinx_axiethernet_create(NICInfo *nd, StreamSlave *peer,
5544c1
                           int txmem, int rxmem)
5544c1
 {
5544c1
     DeviceState *dev;
5544c1
+    Error *errp = NULL;
5544c1
+
5544c1
     qemu_check_nic_model(nd, "xlnx.axi-ethernet");
5544c1
 
5544c1
     dev = qdev_create(NULL, "xlnx.axi-ethernet");
5544c1
     qdev_set_nic_properties(dev, nd);
5544c1
     qdev_prop_set_uint32(dev, "rxmem", rxmem);
5544c1
     qdev_prop_set_uint32(dev, "txmem", txmem);
5544c1
-    object_property_set_link(OBJECT(dev), OBJECT(peer), "tx_dev", NULL);
5544c1
+    object_property_set_link(OBJECT(dev), OBJECT(peer), "tx_dev", &errp);
5544c1
+    assert_no_error(errp);
5544c1
     qdev_init_nofail(dev);
5544c1
     sysbus_mmio_map(sysbus_from_qdev(dev), 0, base);
5544c1
     sysbus_connect_irq(sysbus_from_qdev(dev), 0, irq);
5544c1
@@ -74,8 +77,11 @@ xilinx_axiethernetdma_init(DeviceState *dev, StreamSlave *peer,
5544c1
                            target_phys_addr_t base, qemu_irq irq,
5544c1
                            qemu_irq irq2, int freqhz)
5544c1
 {
5544c1
+    Error *errp = NULL;
5544c1
+
5544c1
     qdev_prop_set_uint32(dev, "freqhz", freqhz);
5544c1
-    object_property_set_link(OBJECT(dev), OBJECT(peer), "tx_dev", NULL);
5544c1
+    object_property_set_link(OBJECT(dev), OBJECT(peer), "tx_dev", &errp);
5544c1
+    assert_no_error(errp);
5544c1
     qdev_init_nofail(dev);
5544c1
 
5544c1
     sysbus_mmio_map(sysbus_from_qdev(dev), 0, base);
5544c1
-- 
5544c1
1.7.12.1
5544c1