diff options
| author | Golla Nagendra <nagendra.golla@amd.com> | 2026-08-14 10:26:15 +0530 |
|---|---|---|
| committer | Vinod Koul <vkoul@kernel.org> | 2026-09-09 19:06:50 +0530 |
| commit | cc38c812cb819257d37bfc28de613ce8fced3ca7 (patch) | |
| tree | 876ee780d7df3c7038139b0a897f5d89a31d0709 | |
| parent | bff5f96e79333f129b9ce1e177eb89e9a738a7fc (diff) | |
| download | linux-next-cc38c812cb819257d37bfc28de613ce8fced3ca7.tar.gz linux-next-cc38c812cb819257d37bfc28de613ce8fced3ca7.zip | |
dmaengine: zynqmp_dma: Reject zero-length memcpy transfers
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 <nagendra.golla@amd.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260814045616.1661199-8-nagendra.golla@amd.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
| -rw-r--r-- | drivers/dma/xilinx/zynqmp_dma.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c index 80cc5020128d..2f7588a7ee39 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); |
