From: Frank Li <Frank.li@oss.nxp.com>
To: Golla Nagendra <nagendra.golla@amd.com>
Cc: vkoul@kernel.org, Frank.Li@kernel.org, michal.simek@amd.com,
robh@kernel.org, krzk+dt@kernel.org, radhey.shyam.pandey@amd.com,
kees@kernel.org, sakari.ailus@linux.intel.com,
yukuai3@huawei.com, git@amd.com, dmaengine@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/6] dmaengine: zynqmp_dma: Fix chan probe error handling
Date: Thu, 6 Aug 2026 10:48:16 -0500 [thread overview]
Message-ID: <anSswBAJJw3ssAKG@SMW015318> (raw)
In-Reply-To: <20260806123014.2120447-3-nagendra.golla@amd.com>
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
>
next prev parent reply other threads:[~2026-08-06 15:48 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
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:48 ` sashiko-bot
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 12:51 ` sashiko-bot
2026-08-06 15:48 ` Frank Li [this message]
2026-08-06 12:30 ` [PATCH 3/6] dmaengine: zynqmp_dma: Fix stale kerneldoc comments Golla Nagendra
2026-08-06 12:42 ` sashiko-bot
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 12:41 ` sashiko-bot
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:44 ` sashiko-bot
2026-08-06 15:56 ` Frank Li
2026-08-07 11:02 ` Golla, Nagendra
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=anSswBAJJw3ssAKG@SMW015318 \
--to=frank.li@oss.nxp.com \
--cc=Frank.Li@kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=git@amd.com \
--cc=kees@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.simek@amd.com \
--cc=nagendra.golla@amd.com \
--cc=radhey.shyam.pandey@amd.com \
--cc=robh@kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=vkoul@kernel.org \
--cc=yukuai3@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.