diff options
author | Philippe Mathieu-Daudé <philmd@redhat.com> | 2021-08-19 18:34:20 +0200 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2021-08-26 17:01:59 +0100 |
commit | 348ba7bede1513f7e5aba0b755380d2ff1720192 (patch) | |
tree | 2af7c68cd1709835b7d6760f11495337b1af4035 /hw/dma | |
parent | 34a3a71db619c46f2a9ab76257d296d9c8b43aeb (diff) | |
download | qemu-348ba7bede1513f7e5aba0b755380d2ff1720192.zip qemu-348ba7bede1513f7e5aba0b755380d2ff1720192.tar.gz qemu-348ba7bede1513f7e5aba0b755380d2ff1720192.tar.bz2 |
hw/dma/xlnx_csu_dma: Run trivial checks early in realize()
If some property are not set, we'll return indicating a failure,
so it is pointless to allocate / initialize some fields too early.
Move the trivial checks earlier in realize().
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20210819163422.2863447-3-philmd@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/dma')
-rw-r--r-- | hw/dma/xlnx_csu_dma.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/hw/dma/xlnx_csu_dma.c b/hw/dma/xlnx_csu_dma.c index 797b4fe..2d19f41 100644 --- a/hw/dma/xlnx_csu_dma.c +++ b/hw/dma/xlnx_csu_dma.c @@ -626,6 +626,11 @@ static void xlnx_csu_dma_realize(DeviceState *dev, Error **errp) XlnxCSUDMA *s = XLNX_CSU_DMA(dev); RegisterInfoArray *reg_array; + if (!s->is_dst && !s->tx_dev) { + error_setg(errp, "zynqmp.csu-dma: Stream not connected"); + return; + } + reg_array = register_init_block32(dev, xlnx_csu_dma_regs_info[!!s->is_dst], XLNX_CSU_DMA_R_MAX, @@ -640,11 +645,6 @@ static void xlnx_csu_dma_realize(DeviceState *dev, Error **errp) sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->iomem); sysbus_init_irq(SYS_BUS_DEVICE(dev), &s->irq); - if (!s->is_dst && !s->tx_dev) { - error_setg(errp, "zynqmp.csu-dma: Stream not connected"); - return; - } - s->src_timer = ptimer_init(xlnx_csu_dma_src_timeout_hit, s, PTIMER_POLICY_DEFAULT); |