[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <82cf913c-f050-4325-ac5b-7efd0634d8ff@arm.com>
Date: Fri, 29 Aug 2025 11:02:06 +0100
From: Robin Murphy <robin.murphy@....com>
To: Jisheng Zhang <jszhang@...nel.org>, Vinod Koul <vkoul@...nel.org>,
Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>
Cc: dmaengine@...r.kernel.org, devicetree@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 03/14] dmaengine: dma350: Check vchan_next_desc() return
value
On 2025-08-23 4:39 pm, Jisheng Zhang wrote:
> vchan_next_desc() may return NULL, check its return value.
IIRC it's important that dch->desc gets set to NULL in that case,
otherwise things can go wonky after a completion interrupt - i.e. the
current code *is* using the return value both ways, just the sneaky
thing is that it does actually depend on "vd" being the first member of
d350_desc to do it concisely, sorry I didn't document that.
Thanks,
Robin.
> Signed-off-by: Jisheng Zhang <jszhang@...nel.org>
> ---
> drivers/dma/arm-dma350.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/dma/arm-dma350.c b/drivers/dma/arm-dma350.c
> index 24cbadc5f076..96350d15ed85 100644
> --- a/drivers/dma/arm-dma350.c
> +++ b/drivers/dma/arm-dma350.c
> @@ -399,11 +399,14 @@ static enum dma_status d350_tx_status(struct dma_chan *chan, dma_cookie_t cookie
> static void d350_start_next(struct d350_chan *dch)
> {
> u32 hdr, *reg;
> + struct virt_dma_desc *vd;
>
> - dch->desc = to_d350_desc(vchan_next_desc(&dch->vc));
> - if (!dch->desc)
> + vd = vchan_next_desc(&dch->vc);
> + if (!vd)
> return;
>
> + dch->desc = to_d350_desc(vd);
> +
> list_del(&dch->desc->vd.node);
> dch->status = DMA_IN_PROGRESS;
> dch->cookie = dch->desc->vd.tx.cookie;
Powered by blists - more mailing lists