[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 2/4] hw/dma/xlnx_csu_dma: Run trivial checks early in real
From: |
Alistair Francis |
Subject: |
Re: [PATCH v2 2/4] hw/dma/xlnx_csu_dma: Run trivial checks early in realize() |
Date: |
Fri, 20 Aug 2021 08:51:08 +1000 |
On Fri, Aug 20, 2021 at 2:35 AM Philippe Mathieu-Daudé
<philmd@redhat.com> wrote:
>
> 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>
Alistair
> ---
> hw/dma/xlnx_csu_dma.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/hw/dma/xlnx_csu_dma.c b/hw/dma/xlnx_csu_dma.c
> index 797b4fed8f5..2d19f415ef3 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);
>
> --
> 2.31.1
>
>
- [PATCH v2 0/4] hw/dma: Always expect 'dma' link property to be set to simplify, Philippe Mathieu-Daudé, 2021/08/19
- [PATCH v2 1/4] hw/arm/xlnx-zynqmp: Realize qspi controller *after* qspi_dma, Philippe Mathieu-Daudé, 2021/08/19
- [PATCH v2 2/4] hw/dma/xlnx_csu_dma: Run trivial checks early in realize(), Philippe Mathieu-Daudé, 2021/08/19
- Re: [PATCH v2 2/4] hw/dma/xlnx_csu_dma: Run trivial checks early in realize(),
Alistair Francis <=
- [PATCH v2 3/4] hw/dma/xlnx_csu_dma: Always expect 'dma' link property to be set, Philippe Mathieu-Daudé, 2021/08/19
- [PATCH v2 4/4] hw/dma/xlnx-zdma Always expect 'dma' link property to be set, Philippe Mathieu-Daudé, 2021/08/19
- Re: [PATCH v2 0/4] hw/dma: Always expect 'dma' link property to be set to simplify, Peter Maydell, 2021/08/26