mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
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>
This commit is contained in:
parent
bff5f96e79
commit
cc38c812cb
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user