Re: [PATCH V2 7/8] dmaengine: zynqmp_dma: Reject zero-length memcpy transfers
Frank Li <[email protected]>
| Newsgroups | org.kernel.vger.dmaengine,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <an9MSn71FMR1Y8q_@SMW015318> |
On Fri, Aug 14, 2026 at 10:26:15AM +0530, Golla Nagendra wrote: > Zero-length prep_memcpy() needlessly consumed a descriptor slot. Reject > zero-length memcpy at prep time and document the behaviour. > > Signed-off-by: Golla Nagendra <[email protected]> > --- Reviewed-by: Frank Li <[email protected]> > Changes in V2: > - No change > --- > drivers/dma/xilinx/zynqmp_dma.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c > index 194abfd6cb25..921d3d9f6ed6 100644 > --- a/drivers/dma/xilinx/zynqmp_dma.c > +++ b/drivers/dma/xilinx/zynqmp_dma.c > @@ -837,7 +837,8 @@ static void zynqmp_dma_synchronize(struct dma_chan *dchan) > * @len: Transfer length > * @flags: transfer ack flags > * > - * Return: Async transaction descriptor on success and NULL on failure > + * Return: Async transaction descriptor on success and NULL on failure or > + * zero length transfer > */ > static struct dma_async_tx_descriptor *zynqmp_dma_prep_memcpy( > struct dma_chan *dchan, dma_addr_t dma_dst, > @@ -852,6 +853,9 @@ static struct dma_async_tx_descriptor *zynqmp_dma_prep_memcpy( > > chan = to_chan(dchan); > > + if (!len) > + return NULL; > + > desc_cnt = DIV_ROUND_UP(len, ZYNQMP_DMA_MAX_TRANS_LEN); > > spin_lock_irqsave(&chan->lock, irqflags); > -- > 2.44.4 >