* [PATCH 0/6] dmaengine: zynqmp_dma: Fix error paths and follow-up cleanups
@ 2026-08-06 12:30 Golla Nagendra
2026-08-06 12:30 ` [PATCH 1/6] dmaengine: zynqmp_dma: Fix alloc_chan_resources error cleanup Golla Nagendra
` (5 more replies)
0 siblings, 6 replies; 13+ messages in thread
From: Golla Nagendra @ 2026-08-06 12:30 UTC (permalink / raw)
To: vkoul, Frank.Li, michal.simek, robh, krzk+dt, radhey.shyam.pandey,
kees, sakari.ailus, yukuai3
Cc: git, dmaengine, linux-arm-kernel, linux-kernel, nagendra.golla
This series fixes error-path cleanup issues in alloc/probe flows and
applies follow-up cleanups in the Xilinx ZynqMP DMA driver.
Patch 1 fixes alloc_chan_resources() rollback after runtime PM has been
acquired, including software descriptor pool cleanup on coherent
allocation failure.
Patch 2 fixes channel probe/remove error handling by preserving
platform_get_irq() errors, initializing/staging chan->irq safely, and
registering the channel node only after IRQ setup succeeds.
Patch 3 updates stale kerneldoc comments to match current behavior.
Patch 4 applies minor whitespace formatting cleanup in
zynqmp_dma_chan_probe().
Patch 5 rejects zero-length memcpy preparations and documents the return
behavior.
Patch 6 removes an unused define and drops a duplicate interrupt enable
bit from the default IRQ mask.
Golla Nagendra (6):
dmaengine: zynqmp_dma: Fix alloc_chan_resources error cleanup
dmaengine: zynqmp_dma: Fix chan probe error handling
dmaengine: zynqmp_dma: Fix stale kerneldoc comments
dmaengine: zynqmp_dma: Fix minor whitespace
dmaengine: zynqmp_dma: Reject zero-length memcpy transfers
dmaengine: zynqmp_dma: Remove unused define and duplicate IRQ bit
drivers/dma/xilinx/zynqmp_dma.c | 72 +++++++++++++++++++++------------
1 file changed, 46 insertions(+), 26 deletions(-)
--
2.43.7
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 1/6] dmaengine: zynqmp_dma: Fix alloc_chan_resources error cleanup
2026-08-06 12:30 [PATCH 0/6] dmaengine: zynqmp_dma: Fix error paths and follow-up cleanups Golla Nagendra
@ 2026-08-06 12:30 ` Golla Nagendra
2026-08-06 15:39 ` Frank Li
2026-08-06 12:30 ` [PATCH 2/6] dmaengine: zynqmp_dma: Fix chan probe error handling Golla Nagendra
` (4 subsequent siblings)
5 siblings, 1 reply; 13+ messages in thread
From: Golla Nagendra @ 2026-08-06 12:30 UTC (permalink / raw)
To: vkoul, Frank.Li, michal.simek, robh, krzk+dt, radhey.shyam.pandey,
kees, sakari.ailus, yukuai3
Cc: git, dmaengine, linux-arm-kernel, linux-kernel, nagendra.golla
Channel resource allocation can fail after runtime PM has been acquired
and after part of the descriptor state has been initialized. Without
proper rollback, the error path leaks a runtime PM reference and, on
coherent allocation failure, also leaks the software descriptor pool.
Fix this by balancing runtime PM usage before returning an error and
releasing any partially allocated software descriptor pool.
Fixes: 8982d48af36d ("dmaengine: zynqmp_dma: Fix PM reference leak in zynqmp_dma_alloc_chan_resourc()")
Signed-off-by: Golla Nagendra <nagendra.golla@amd.com>
---
drivers/dma/xilinx/zynqmp_dma.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c
index f6a812e49ddc..b7c561280694 100644
--- a/drivers/dma/xilinx/zynqmp_dma.c
+++ b/drivers/dma/xilinx/zynqmp_dma.c
@@ -483,8 +483,10 @@ static int zynqmp_dma_alloc_chan_resources(struct dma_chan *dchan)
return ret;
chan->sw_desc_pool = kzalloc_objs(*desc, ZYNQMP_DMA_NUM_DESCS);
- if (!chan->sw_desc_pool)
- return -ENOMEM;
+ if (!chan->sw_desc_pool) {
+ ret = -ENOMEM;
+ goto err_pm;
+ }
chan->idle = true;
chan->desc_free_cnt = ZYNQMP_DMA_NUM_DESCS;
@@ -502,8 +504,10 @@ static int zynqmp_dma_alloc_chan_resources(struct dma_chan *dchan)
(2 * ZYNQMP_DMA_DESC_SIZE(chan) *
ZYNQMP_DMA_NUM_DESCS),
&chan->desc_pool_p, GFP_KERNEL);
- if (!chan->desc_pool_v)
- return -ENOMEM;
+ if (!chan->desc_pool_v) {
+ ret = -ENOMEM;
+ goto err_free_sw_desc_pool;
+ }
for (i = 0; i < ZYNQMP_DMA_NUM_DESCS; i++) {
desc = chan->sw_desc_pool + i;
@@ -516,6 +520,13 @@ static int zynqmp_dma_alloc_chan_resources(struct dma_chan *dchan)
}
return ZYNQMP_DMA_NUM_DESCS;
+
+err_free_sw_desc_pool:
+ kfree(chan->sw_desc_pool);
+ chan->sw_desc_pool = NULL;
+err_pm:
+ pm_runtime_put_autosuspend(chan->dev);
+ return ret;
}
/**
--
2.43.7
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 2/6] dmaengine: zynqmp_dma: Fix chan probe error handling
2026-08-06 12:30 [PATCH 0/6] dmaengine: zynqmp_dma: Fix error paths and follow-up cleanups Golla Nagendra
2026-08-06 12:30 ` [PATCH 1/6] dmaengine: zynqmp_dma: Fix alloc_chan_resources error cleanup Golla Nagendra
@ 2026-08-06 12:30 ` Golla Nagendra
2026-08-06 15:48 ` Frank Li
2026-08-06 12:30 ` [PATCH 3/6] dmaengine: zynqmp_dma: Fix stale kerneldoc comments Golla Nagendra
` (3 subsequent siblings)
5 siblings, 1 reply; 13+ messages in thread
From: Golla Nagendra @ 2026-08-06 12:30 UTC (permalink / raw)
To: vkoul, Frank.Li, michal.simek, robh, krzk+dt, radhey.shyam.pandey,
kees, sakari.ailus, yukuai3
Cc: git, dmaengine, linux-arm-kernel, linux-kernel, nagendra.golla
Keep the real platform_get_irq() error value by returning ret directly,
initialize chan->irq to -1, and only assign chan->irq after
devm_request_irq() succeeds. In remove, free IRQ only for valid numbers
and delete device_node only when linked.
Move channel list registration to after successful IRQ registration,
initialize device_node list head during probe setup, and kill the
tasklet in the outer probe failure path when channel probe fails.
Fixes: b0cc417c1637 ("dmaengine: Add Xilinx zynqmp dma engine driver support")
Signed-off-by: Golla Nagendra <nagendra.golla@amd.com>
---
drivers/dma/xilinx/zynqmp_dma.c | 28 ++++++++++++++++++----------
1 file changed, 18 insertions(+), 10 deletions(-)
diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c
index b7c561280694..f7e4a177bd17 100644
--- a/drivers/dma/xilinx/zynqmp_dma.c
+++ b/drivers/dma/xilinx/zynqmp_dma.c
@@ -205,7 +205,7 @@ struct zynqmp_dma_desc_sw {
* @desc_pool_p: Physical allocated descriptor base
* @desc_free_cnt: Descriptor available count
* @dev: The dma device
- * @irq: Channel IRQ
+ * @irq: Linux IRQ number, or -1 when not registered
* @is_dmacoherent: Tells whether dma operations are coherent or not
* @tasklet: Cleanup work after irq
* @idle : Channel status;
@@ -896,10 +896,11 @@ static void zynqmp_dma_chan_remove(struct zynqmp_dma_chan *chan)
if (!chan)
return;
- if (chan->irq)
+ if (chan->irq >= 0)
devm_free_irq(chan->zdev->dev, chan->irq, chan);
tasklet_kill(&chan->tasklet);
- list_del(&chan->common.device_node);
+ if (!list_empty(&chan->common.device_node))
+ list_del(&chan->common.device_node);
}
/**
@@ -915,13 +916,14 @@ static int zynqmp_dma_chan_probe(struct zynqmp_dma_device *zdev,
struct zynqmp_dma_chan *chan;
struct device_node *node = pdev->dev.of_node;
const struct zynqmp_dma_config *match_data;
- int err;
+ int err, ret;
chan = devm_kzalloc(zdev->dev, sizeof(*chan), GFP_KERNEL);
if (!chan)
return -ENOMEM;
chan->dev = zdev->dev;
chan->zdev = zdev;
+ chan->irq = -1;
chan->regs = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(chan->regs))
@@ -954,22 +956,26 @@ static int zynqmp_dma_chan_probe(struct zynqmp_dma_device *zdev,
INIT_LIST_HEAD(&chan->pending_list);
INIT_LIST_HEAD(&chan->done_list);
INIT_LIST_HEAD(&chan->free_list);
+ INIT_LIST_HEAD(&chan->common.device_node);
dma_cookie_init(&chan->common);
chan->common.device = &zdev->common;
- list_add_tail(&chan->common.device_node, &zdev->common.channels);
-
zynqmp_dma_init(chan);
- chan->irq = platform_get_irq(pdev, 0);
- if (chan->irq < 0)
- return -ENXIO;
- err = devm_request_irq(&pdev->dev, chan->irq, zynqmp_dma_irq_handler, 0,
+ ret = platform_get_irq(pdev, 0);
+ if (ret < 0)
+ return ret;
+
+ err = devm_request_irq(&pdev->dev, ret, zynqmp_dma_irq_handler, 0,
"zynqmp-dma", chan);
if (err)
return err;
+ chan->irq = ret;
+
chan->desc_size = sizeof(struct zynqmp_dma_desc_ll);
chan->idle = true;
+ list_add_tail(&chan->common.device_node, &zdev->common.channels);
+
return 0;
}
@@ -1134,6 +1140,8 @@ static int zynqmp_dma_probe(struct platform_device *pdev)
ret = zynqmp_dma_chan_probe(zdev, pdev);
if (ret) {
dev_err_probe(&pdev->dev, ret, "Probing channel failed\n");
+ if (zdev->chan)
+ tasklet_kill(&zdev->chan->tasklet);
goto err_disable_pm;
}
--
2.43.7
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 3/6] dmaengine: zynqmp_dma: Fix stale kerneldoc comments
2026-08-06 12:30 [PATCH 0/6] dmaengine: zynqmp_dma: Fix error paths and follow-up cleanups Golla Nagendra
2026-08-06 12:30 ` [PATCH 1/6] dmaengine: zynqmp_dma: Fix alloc_chan_resources error cleanup Golla Nagendra
2026-08-06 12:30 ` [PATCH 2/6] dmaengine: zynqmp_dma: Fix chan probe error handling Golla Nagendra
@ 2026-08-06 12:30 ` Golla Nagendra
2026-08-06 15:49 ` Frank Li
2026-08-06 12:30 ` [PATCH 4/6] dmaengine: zynqmp_dma: Fix minor whitespace Golla Nagendra
` (2 subsequent siblings)
5 siblings, 1 reply; 13+ messages in thread
From: Golla Nagendra @ 2026-08-06 12:30 UTC (permalink / raw)
To: vkoul, Frank.Li, michal.simek, robh, krzk+dt, radhey.shyam.pandey,
kees, sakari.ailus, yukuai3
Cc: git, dmaengine, linux-arm-kernel, linux-kernel, nagendra.golla
Correct kerneldoc comments that no longer matched the code.
Signed-off-by: Golla Nagendra <nagendra.golla@amd.com>
---
drivers/dma/xilinx/zynqmp_dma.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c
index f7e4a177bd17..c5b05fd52e9d 100644
--- a/drivers/dma/xilinx/zynqmp_dma.c
+++ b/drivers/dma/xilinx/zynqmp_dma.c
@@ -208,7 +208,7 @@ struct zynqmp_dma_desc_sw {
* @irq: Linux IRQ number, or -1 when not registered
* @is_dmacoherent: Tells whether dma operations are coherent or not
* @tasklet: Cleanup work after irq
- * @idle : Channel status;
+ * @idle: Channel status
* @desc_size: Size of the low level descriptor
* @err: Channel has errors
* @bus_width: Bus width
@@ -435,7 +435,7 @@ zynqmp_dma_get_descriptor(struct zynqmp_dma_chan *chan)
}
/**
- * zynqmp_dma_free_descriptor - Issue pending transactions
+ * zynqmp_dma_free_descriptor - Return a descriptor to the free pool
* @chan: ZynqMP DMA channel pointer
* @sdesc: Transaction descriptor pointer
*/
@@ -617,7 +617,6 @@ static void zynqmp_dma_start_transfer(struct zynqmp_dma_chan *chan)
zynqmp_dma_start(chan);
}
-
/**
* zynqmp_dma_chan_desc_cleanup - Cleanup the completed descriptors
* @chan: ZynqMP DMA channel
@@ -908,7 +907,7 @@ static void zynqmp_dma_chan_remove(struct zynqmp_dma_chan *chan)
* @zdev: Driver specific device structure
* @pdev: Pointer to the platform_device structure
*
- * Return: '0' on success and failure value on error
+ * Return: 0 on success and negative error code on failure
*/
static int zynqmp_dma_chan_probe(struct zynqmp_dma_device *zdev,
struct platform_device *pdev)
@@ -1042,11 +1041,11 @@ static int __maybe_unused zynqmp_dma_runtime_suspend(struct device *dev)
}
/**
- * zynqmp_dma_runtime_resume - Runtime suspend method for the driver
+ * zynqmp_dma_runtime_resume - Runtime resume method for the driver
* @dev: Address of the device structure
*
- * Put the driver into low power mode.
- * Return: 0 always
+ * Enable device clocks.
+ * Return: 0 on success and failure value on error
*/
static int __maybe_unused zynqmp_dma_runtime_resume(struct device *dev)
{
--
2.43.7
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 4/6] dmaengine: zynqmp_dma: Fix minor whitespace
2026-08-06 12:30 [PATCH 0/6] dmaengine: zynqmp_dma: Fix error paths and follow-up cleanups Golla Nagendra
` (2 preceding siblings ...)
2026-08-06 12:30 ` [PATCH 3/6] dmaengine: zynqmp_dma: Fix stale kerneldoc comments Golla Nagendra
@ 2026-08-06 12:30 ` Golla Nagendra
2026-08-06 15:53 ` Frank Li
2026-08-06 12:30 ` [PATCH 5/6] dmaengine: zynqmp_dma: Reject zero-length memcpy transfers Golla Nagendra
2026-08-06 12:30 ` [PATCH 6/6] dmaengine: zynqmp_dma: Remove unused define and duplicate IRQ bit Golla Nagendra
5 siblings, 1 reply; 13+ messages in thread
From: Golla Nagendra @ 2026-08-06 12:30 UTC (permalink / raw)
To: vkoul, Frank.Li, michal.simek, robh, krzk+dt, radhey.shyam.pandey,
kees, sakari.ailus, yukuai3
Cc: git, dmaengine, linux-arm-kernel, linux-kernel, nagendra.golla
Fix minor whitespace formatting in zynqmp_dma_chan_probe().
Signed-off-by: Golla Nagendra <nagendra.golla@amd.com>
---
drivers/dma/xilinx/zynqmp_dma.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c
index c5b05fd52e9d..2d56ea08ce45 100644
--- a/drivers/dma/xilinx/zynqmp_dma.c
+++ b/drivers/dma/xilinx/zynqmp_dma.c
@@ -947,7 +947,7 @@ static int zynqmp_dma_chan_probe(struct zynqmp_dma_device *zdev,
if (match_data)
chan->irq_offset = match_data->offset;
- chan->is_dmacoherent = of_property_read_bool(node, "dma-coherent");
+ chan->is_dmacoherent = of_property_read_bool(node, "dma-coherent");
zdev->chan = chan;
tasklet_setup(&chan->tasklet, zynqmp_dma_do_tasklet);
spin_lock_init(&chan->lock);
@@ -959,6 +959,7 @@ static int zynqmp_dma_chan_probe(struct zynqmp_dma_device *zdev,
dma_cookie_init(&chan->common);
chan->common.device = &zdev->common;
+
zynqmp_dma_init(chan);
ret = platform_get_irq(pdev, 0);
if (ret < 0)
--
2.43.7
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 5/6] dmaengine: zynqmp_dma: Reject zero-length memcpy transfers
2026-08-06 12:30 [PATCH 0/6] dmaengine: zynqmp_dma: Fix error paths and follow-up cleanups Golla Nagendra
` (3 preceding siblings ...)
2026-08-06 12:30 ` [PATCH 4/6] dmaengine: zynqmp_dma: Fix minor whitespace Golla Nagendra
@ 2026-08-06 12:30 ` Golla Nagendra
2026-08-06 15:56 ` Frank Li
2026-08-06 12:30 ` [PATCH 6/6] dmaengine: zynqmp_dma: Remove unused define and duplicate IRQ bit Golla Nagendra
5 siblings, 1 reply; 13+ messages in thread
From: Golla Nagendra @ 2026-08-06 12:30 UTC (permalink / raw)
To: vkoul, Frank.Li, michal.simek, robh, krzk+dt, radhey.shyam.pandey,
kees, sakari.ailus, yukuai3
Cc: git, dmaengine, linux-arm-kernel, linux-kernel, nagendra.golla
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>
---
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 2d56ea08ce45..e70874d65123 100644
--- a/drivers/dma/xilinx/zynqmp_dma.c
+++ b/drivers/dma/xilinx/zynqmp_dma.c
@@ -836,7 +836,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,
@@ -851,6 +852,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.43.7
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 6/6] dmaengine: zynqmp_dma: Remove unused define and duplicate IRQ bit
2026-08-06 12:30 [PATCH 0/6] dmaengine: zynqmp_dma: Fix error paths and follow-up cleanups Golla Nagendra
` (4 preceding siblings ...)
2026-08-06 12:30 ` [PATCH 5/6] dmaengine: zynqmp_dma: Reject zero-length memcpy transfers Golla Nagendra
@ 2026-08-06 12:30 ` Golla Nagendra
2026-08-06 16:00 ` Frank Li
5 siblings, 1 reply; 13+ messages in thread
From: Golla Nagendra @ 2026-08-06 12:30 UTC (permalink / raw)
To: vkoul, Frank.Li, michal.simek, robh, krzk+dt, radhey.shyam.pandey,
kees, sakari.ailus, yukuai3
Cc: git, dmaengine, linux-arm-kernel, linux-kernel, nagendra.golla
Remove the unused ZYNQMP_DMA_SRC_ISSUE_RST_VAL define.
ZYNQMP_DMA_DST_DSCR_DONE was also set twice in the default interrupt enable
mask; remove the duplicate bit.
Signed-off-by: Golla Nagendra <nagendra.golla@amd.com>
---
drivers/dma/xilinx/zynqmp_dma.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c
index e70874d65123..fd2dee4ea17f 100644
--- a/drivers/dma/xilinx/zynqmp_dma.c
+++ b/drivers/dma/xilinx/zynqmp_dma.c
@@ -112,8 +112,7 @@
#define ZYNQMP_DMA_INT_DONE (ZYNQMP_DMA_DONE | ZYNQMP_DMA_DST_DSCR_DONE)
#define ZYNQMP_DMA_INT_EN_DEFAULT_MASK (ZYNQMP_DMA_INT_DONE | \
ZYNQMP_DMA_INT_ERR | \
- ZYNQMP_DMA_INT_OVRFL | \
- ZYNQMP_DMA_DST_DSCR_DONE)
+ ZYNQMP_DMA_INT_OVRFL)
/* Max number of descriptors per channel */
#define ZYNQMP_DMA_NUM_DESCS 32
@@ -128,8 +127,6 @@
/* Reset values for data attributes */
#define ZYNQMP_DMA_AXCACHE_VAL 0xF
-#define ZYNQMP_DMA_SRC_ISSUE_RST_VAL 0x1F
-
#define ZYNQMP_DMA_IDS_DEFAULT_MASK 0xFFF
/* Bus width in bits */
--
2.43.7
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 1/6] dmaengine: zynqmp_dma: Fix alloc_chan_resources error cleanup
2026-08-06 12:30 ` [PATCH 1/6] dmaengine: zynqmp_dma: Fix alloc_chan_resources error cleanup Golla Nagendra
@ 2026-08-06 15:39 ` Frank Li
0 siblings, 0 replies; 13+ messages in thread
From: Frank Li @ 2026-08-06 15:39 UTC (permalink / raw)
To: Golla Nagendra
Cc: vkoul, Frank.Li, michal.simek, robh, krzk+dt, radhey.shyam.pandey,
kees, sakari.ailus, yukuai3, git, dmaengine, linux-arm-kernel,
linux-kernel
On Thu, Aug 06, 2026 at 06:00:09PM +0530, Golla Nagendra wrote:
> Channel resource allocation can fail after runtime PM has been acquired
> and after part of the descriptor state has been initialized. Without
> proper rollback, the error path leaks a runtime PM reference and, on
> coherent allocation failure, also leaks the software descriptor pool.
>
> Fix this by balancing runtime PM usage before returning an error and
> releasing any partially allocated software descriptor pool.
>
> Fixes: 8982d48af36d ("dmaengine: zynqmp_dma: Fix PM reference leak in zynqmp_dma_alloc_chan_resourc()")
> Signed-off-by: Golla Nagendra <nagendra.golla@amd.com>
> ---
> drivers/dma/xilinx/zynqmp_dma.c | 19 +++++++++++++++----
> 1 file changed, 15 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c
> index f6a812e49ddc..b7c561280694 100644
> --- a/drivers/dma/xilinx/zynqmp_dma.c
> +++ b/drivers/dma/xilinx/zynqmp_dma.c
> @@ -483,8 +483,10 @@ static int zynqmp_dma_alloc_chan_resources(struct dma_chan *dchan)
> return ret;
>
> chan->sw_desc_pool = kzalloc_objs(*desc, ZYNQMP_DMA_NUM_DESCS);
> - if (!chan->sw_desc_pool)
> - return -ENOMEM;
> + if (!chan->sw_desc_pool) {
> + ret = -ENOMEM;
> + goto err_pm;
> + }
>
> chan->idle = true;
> chan->desc_free_cnt = ZYNQMP_DMA_NUM_DESCS;
> @@ -502,8 +504,10 @@ static int zynqmp_dma_alloc_chan_resources(struct dma_chan *dchan)
> (2 * ZYNQMP_DMA_DESC_SIZE(chan) *
> ZYNQMP_DMA_NUM_DESCS),
> &chan->desc_pool_p, GFP_KERNEL);
> - if (!chan->desc_pool_v)
> - return -ENOMEM;
> + if (!chan->desc_pool_v) {
> + ret = -ENOMEM;
> + goto err_free_sw_desc_pool;
This is seperated problem. Need use new patch to fix it.
Frank
> + }
>
> for (i = 0; i < ZYNQMP_DMA_NUM_DESCS; i++) {
> desc = chan->sw_desc_pool + i;
> @@ -516,6 +520,13 @@ static int zynqmp_dma_alloc_chan_resources(struct dma_chan *dchan)
> }
>
> return ZYNQMP_DMA_NUM_DESCS;
> +
> +err_free_sw_desc_pool:
> + kfree(chan->sw_desc_pool);
> + chan->sw_desc_pool = NULL;
> +err_pm:
> + pm_runtime_put_autosuspend(chan->dev);
> + return ret;
> }
>
> /**
> --
> 2.43.7
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/6] dmaengine: zynqmp_dma: Fix chan probe error handling
2026-08-06 12:30 ` [PATCH 2/6] dmaengine: zynqmp_dma: Fix chan probe error handling Golla Nagendra
@ 2026-08-06 15:48 ` Frank Li
0 siblings, 0 replies; 13+ messages in thread
From: Frank Li @ 2026-08-06 15:48 UTC (permalink / raw)
To: Golla Nagendra
Cc: vkoul, Frank.Li, michal.simek, robh, krzk+dt, radhey.shyam.pandey,
kees, sakari.ailus, yukuai3, git, dmaengine, linux-arm-kernel,
linux-kernel
On Thu, Aug 06, 2026 at 06:00:10PM +0530, Golla Nagendra wrote:
> Keep the real platform_get_irq() error value by returning ret directly,
> initialize chan->irq to -1, and only assign chan->irq after
> devm_request_irq() succeeds. In remove, free IRQ only for valid numbers
> and delete device_node only when linked.
>
> Move channel list registration to after successful IRQ registration,
> initialize device_node list head during probe setup, and kill the
> tasklet in the outer probe failure path when channel probe fails.
>
> Fixes: b0cc417c1637 ("dmaengine: Add Xilinx zynqmp dma engine driver support")
> Signed-off-by: Golla Nagendra <nagendra.golla@amd.com>
> ---
> drivers/dma/xilinx/zynqmp_dma.c | 28 ++++++++++++++++++----------
> 1 file changed, 18 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c
> index b7c561280694..f7e4a177bd17 100644
> --- a/drivers/dma/xilinx/zynqmp_dma.c
> +++ b/drivers/dma/xilinx/zynqmp_dma.c
> @@ -205,7 +205,7 @@ struct zynqmp_dma_desc_sw {
> * @desc_pool_p: Physical allocated descriptor base
g> * @desc_free_cnt: Descriptor available count
> * @dev: The dma device
> - * @irq: Channel IRQ
> + * @irq: Linux IRQ number, or -1 when not registered
> * @is_dmacoherent: Tells whether dma operations are coherent or not
> * @tasklet: Cleanup work after irq
> * @idle : Channel status;
> @@ -896,10 +896,11 @@ static void zynqmp_dma_chan_remove(struct zynqmp_dma_chan *chan)
> if (!chan)
> return;
>
> - if (chan->irq)
> + if (chan->irq >= 0)
> devm_free_irq(chan->zdev->dev, chan->irq, chan);
> tasklet_kill(&chan->tasklet);
> - list_del(&chan->common.device_node);
> + if (!list_empty(&chan->common.device_node))
> + list_del(&chan->common.device_node);
> }
>
> /**
> @@ -915,13 +916,14 @@ static int zynqmp_dma_chan_probe(struct zynqmp_dma_device *zdev,
> struct zynqmp_dma_chan *chan;
> struct device_node *node = pdev->dev.of_node;
> const struct zynqmp_dma_config *match_data;
> - int err;
> + int err, ret;
>
> chan = devm_kzalloc(zdev->dev, sizeof(*chan), GFP_KERNEL);
> if (!chan)
> return -ENOMEM;
> chan->dev = zdev->dev;
> chan->zdev = zdev;
> + chan->irq = -1;
>
> chan->regs = devm_platform_ioremap_resource(pdev, 0);
> if (IS_ERR(chan->regs))
> @@ -954,22 +956,26 @@ static int zynqmp_dma_chan_probe(struct zynqmp_dma_device *zdev,
> INIT_LIST_HEAD(&chan->pending_list);
> INIT_LIST_HEAD(&chan->done_list);
> INIT_LIST_HEAD(&chan->free_list);
> + INIT_LIST_HEAD(&chan->common.device_node);
>
> dma_cookie_init(&chan->common);
> chan->common.device = &zdev->common;
> - list_add_tail(&chan->common.device_node, &zdev->common.channels);
> -
> zynqmp_dma_init(chan);
> - chan->irq = platform_get_irq(pdev, 0);
> - if (chan->irq < 0)
> - return -ENXIO;
> - err = devm_request_irq(&pdev->dev, chan->irq, zynqmp_dma_irq_handler, 0,
> + ret = platform_get_irq(pdev, 0);
> + if (ret < 0)
> + return ret;
> +
> + err = devm_request_irq(&pdev->dev, ret, zynqmp_dma_irq_handler, 0,
> "zynqmp-dma", chan);
> if (err)
> return err;
>
> + chan->irq = ret;
> +
> chan->desc_size = sizeof(struct zynqmp_dma_desc_ll);
> chan->idle = true;
> + list_add_tail(&chan->common.device_node, &zdev->common.channels);
> +
> return 0;
> }
>
> @@ -1134,6 +1140,8 @@ static int zynqmp_dma_probe(struct platform_device *pdev)
> ret = zynqmp_dma_chan_probe(zdev, pdev);
> if (ret) {
> dev_err_probe(&pdev->dev, ret, "Probing channel failed\n");
> + if (zdev->chan)
> + tasklet_kill(&zdev->chan->tasklet);
there are already have goto, tear down move goto section.
Frank
> goto err_disable_pm;
> }
>
> --
> 2.43.7
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 3/6] dmaengine: zynqmp_dma: Fix stale kerneldoc comments
2026-08-06 12:30 ` [PATCH 3/6] dmaengine: zynqmp_dma: Fix stale kerneldoc comments Golla Nagendra
@ 2026-08-06 15:49 ` Frank Li
0 siblings, 0 replies; 13+ messages in thread
From: Frank Li @ 2026-08-06 15:49 UTC (permalink / raw)
To: Golla Nagendra
Cc: vkoul, Frank.Li, michal.simek, robh, krzk+dt, radhey.shyam.pandey,
kees, sakari.ailus, yukuai3, git, dmaengine, linux-arm-kernel,
linux-kernel
On Thu, Aug 06, 2026 at 06:00:11PM +0530, Golla Nagendra wrote:
> Correct kerneldoc comments that no longer matched the code.
>
> Signed-off-by: Golla Nagendra <nagendra.golla@amd.com>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> drivers/dma/xilinx/zynqmp_dma.c | 13 ++++++-------
> 1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c
> index f7e4a177bd17..c5b05fd52e9d 100644
> --- a/drivers/dma/xilinx/zynqmp_dma.c
> +++ b/drivers/dma/xilinx/zynqmp_dma.c
> @@ -208,7 +208,7 @@ struct zynqmp_dma_desc_sw {
> * @irq: Linux IRQ number, or -1 when not registered
> * @is_dmacoherent: Tells whether dma operations are coherent or not
> * @tasklet: Cleanup work after irq
> - * @idle : Channel status;
> + * @idle: Channel status
> * @desc_size: Size of the low level descriptor
> * @err: Channel has errors
> * @bus_width: Bus width
> @@ -435,7 +435,7 @@ zynqmp_dma_get_descriptor(struct zynqmp_dma_chan *chan)
> }
>
> /**
> - * zynqmp_dma_free_descriptor - Issue pending transactions
> + * zynqmp_dma_free_descriptor - Return a descriptor to the free pool
> * @chan: ZynqMP DMA channel pointer
> * @sdesc: Transaction descriptor pointer
> */
> @@ -617,7 +617,6 @@ static void zynqmp_dma_start_transfer(struct zynqmp_dma_chan *chan)
> zynqmp_dma_start(chan);
> }
>
> -
> /**
> * zynqmp_dma_chan_desc_cleanup - Cleanup the completed descriptors
> * @chan: ZynqMP DMA channel
> @@ -908,7 +907,7 @@ static void zynqmp_dma_chan_remove(struct zynqmp_dma_chan *chan)
> * @zdev: Driver specific device structure
> * @pdev: Pointer to the platform_device structure
> *
> - * Return: '0' on success and failure value on error
> + * Return: 0 on success and negative error code on failure
> */
> static int zynqmp_dma_chan_probe(struct zynqmp_dma_device *zdev,
> struct platform_device *pdev)
> @@ -1042,11 +1041,11 @@ static int __maybe_unused zynqmp_dma_runtime_suspend(struct device *dev)
> }
>
> /**
> - * zynqmp_dma_runtime_resume - Runtime suspend method for the driver
> + * zynqmp_dma_runtime_resume - Runtime resume method for the driver
> * @dev: Address of the device structure
> *
> - * Put the driver into low power mode.
> - * Return: 0 always
> + * Enable device clocks.
> + * Return: 0 on success and failure value on error
> */
> static int __maybe_unused zynqmp_dma_runtime_resume(struct device *dev)
> {
> --
> 2.43.7
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 4/6] dmaengine: zynqmp_dma: Fix minor whitespace
2026-08-06 12:30 ` [PATCH 4/6] dmaengine: zynqmp_dma: Fix minor whitespace Golla Nagendra
@ 2026-08-06 15:53 ` Frank Li
0 siblings, 0 replies; 13+ messages in thread
From: Frank Li @ 2026-08-06 15:53 UTC (permalink / raw)
To: Golla Nagendra
Cc: vkoul, Frank.Li, michal.simek, robh, krzk+dt, radhey.shyam.pandey,
kees, sakari.ailus, yukuai3, git, dmaengine, linux-arm-kernel,
linux-kernel
On Thu, Aug 06, 2026 at 06:00:12PM +0530, Golla Nagendra wrote:
> Fix minor whitespace formatting in zynqmp_dma_chan_probe().
>
> Signed-off-by: Golla Nagendra <nagendra.golla@amd.com>
> ---
> drivers/dma/xilinx/zynqmp_dma.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c
> index c5b05fd52e9d..2d56ea08ce45 100644
> --- a/drivers/dma/xilinx/zynqmp_dma.c
> +++ b/drivers/dma/xilinx/zynqmp_dma.c
> @@ -947,7 +947,7 @@ static int zynqmp_dma_chan_probe(struct zynqmp_dma_device *zdev,
> if (match_data)
> chan->irq_offset = match_data->offset;
>
> - chan->is_dmacoherent = of_property_read_bool(node, "dma-coherent");
> + chan->is_dmacoherent = of_property_read_bool(node, "dma-coherent");
You should not parse this common property, call of_dma_is_coherent() ?
Frank
> zdev->chan = chan;
> tasklet_setup(&chan->tasklet, zynqmp_dma_do_tasklet);
> spin_lock_init(&chan->lock);
> @@ -959,6 +959,7 @@ static int zynqmp_dma_chan_probe(struct zynqmp_dma_device *zdev,
>
> dma_cookie_init(&chan->common);
> chan->common.device = &zdev->common;
> +
> zynqmp_dma_init(chan);
> ret = platform_get_irq(pdev, 0);
> if (ret < 0)
> --
> 2.43.7
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 5/6] dmaengine: zynqmp_dma: Reject zero-length memcpy transfers
2026-08-06 12:30 ` [PATCH 5/6] dmaengine: zynqmp_dma: Reject zero-length memcpy transfers Golla Nagendra
@ 2026-08-06 15:56 ` Frank Li
0 siblings, 0 replies; 13+ messages in thread
From: Frank Li @ 2026-08-06 15:56 UTC (permalink / raw)
To: Golla Nagendra
Cc: vkoul, Frank.Li, michal.simek, robh, krzk+dt, radhey.shyam.pandey,
kees, sakari.ailus, yukuai3, git, dmaengine, linux-arm-kernel,
linux-kernel
On Thu, Aug 06, 2026 at 06:00:13PM +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 <nagendra.golla@amd.com>
> ---
Is it caller problem, which pass down zero len? or are there special usage,
such as memory barrier.
Frank
> 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 2d56ea08ce45..e70874d65123 100644
> --- a/drivers/dma/xilinx/zynqmp_dma.c
> +++ b/drivers/dma/xilinx/zynqmp_dma.c
> @@ -836,7 +836,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,
> @@ -851,6 +852,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.43.7
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 6/6] dmaengine: zynqmp_dma: Remove unused define and duplicate IRQ bit
2026-08-06 12:30 ` [PATCH 6/6] dmaengine: zynqmp_dma: Remove unused define and duplicate IRQ bit Golla Nagendra
@ 2026-08-06 16:00 ` Frank Li
0 siblings, 0 replies; 13+ messages in thread
From: Frank Li @ 2026-08-06 16:00 UTC (permalink / raw)
To: Golla Nagendra
Cc: vkoul, Frank.Li, michal.simek, robh, krzk+dt, radhey.shyam.pandey,
kees, sakari.ailus, yukuai3, git, dmaengine, linux-arm-kernel,
linux-kernel
On Thu, Aug 06, 2026 at 06:00:14PM +0530, Golla Nagendra wrote:
> Remove the unused ZYNQMP_DMA_SRC_ISSUE_RST_VAL define.
> ZYNQMP_DMA_DST_DSCR_DONE was also set twice in the default interrupt enable
> mask; remove the duplicate bit.
>
> Signed-off-by: Golla Nagendra <nagendra.golla@amd.com>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> drivers/dma/xilinx/zynqmp_dma.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c
> index e70874d65123..fd2dee4ea17f 100644
> --- a/drivers/dma/xilinx/zynqmp_dma.c
> +++ b/drivers/dma/xilinx/zynqmp_dma.c
> @@ -112,8 +112,7 @@
> #define ZYNQMP_DMA_INT_DONE (ZYNQMP_DMA_DONE | ZYNQMP_DMA_DST_DSCR_DONE)
> #define ZYNQMP_DMA_INT_EN_DEFAULT_MASK (ZYNQMP_DMA_INT_DONE | \
> ZYNQMP_DMA_INT_ERR | \
> - ZYNQMP_DMA_INT_OVRFL | \
> - ZYNQMP_DMA_DST_DSCR_DONE)
> + ZYNQMP_DMA_INT_OVRFL)
>
> /* Max number of descriptors per channel */
> #define ZYNQMP_DMA_NUM_DESCS 32
> @@ -128,8 +127,6 @@
> /* Reset values for data attributes */
> #define ZYNQMP_DMA_AXCACHE_VAL 0xF
>
> -#define ZYNQMP_DMA_SRC_ISSUE_RST_VAL 0x1F
> -
> #define ZYNQMP_DMA_IDS_DEFAULT_MASK 0xFFF
>
> /* Bus width in bits */
> --
> 2.43.7
>
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2026-08-06 16:00 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-06 12:30 [PATCH 0/6] dmaengine: zynqmp_dma: Fix error paths and follow-up cleanups Golla Nagendra
2026-08-06 12:30 ` [PATCH 1/6] dmaengine: zynqmp_dma: Fix alloc_chan_resources error cleanup Golla Nagendra
2026-08-06 15:39 ` Frank Li
2026-08-06 12:30 ` [PATCH 2/6] dmaengine: zynqmp_dma: Fix chan probe error handling Golla Nagendra
2026-08-06 15:48 ` Frank Li
2026-08-06 12:30 ` [PATCH 3/6] dmaengine: zynqmp_dma: Fix stale kerneldoc comments Golla Nagendra
2026-08-06 15:49 ` Frank Li
2026-08-06 12:30 ` [PATCH 4/6] dmaengine: zynqmp_dma: Fix minor whitespace Golla Nagendra
2026-08-06 15:53 ` Frank Li
2026-08-06 12:30 ` [PATCH 5/6] dmaengine: zynqmp_dma: Reject zero-length memcpy transfers Golla Nagendra
2026-08-06 15:56 ` Frank Li
2026-08-06 12:30 ` [PATCH 6/6] dmaengine: zynqmp_dma: Remove unused define and duplicate IRQ bit Golla Nagendra
2026-08-06 16:00 ` Frank Li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox