From: Frank Li <Frank.li@oss.nxp.com>
To: Pengpeng Hou <pengpeng@iscas.ac.cn>, joy.zou@nxp.com
Cc: Frank Li <Frank.Li@nxp.com>, Vinod Koul <vkoul@kernel.org>,
imx@lists.linux.dev, dmaengine@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] dmaengine: fsl-edma: make channel resource allocation transactional
Date: Mon, 31 Aug 2026 10:46:18 -0500 [thread overview]
Message-ID: <apWhyl5RKCtmEbzv@SMW015318> (raw)
In-Reply-To: <20260830140925.30268-1-pengpeng@iscas.ac.cn>
On Sun, Aug 30, 2026 at 10:09:25PM +0800, Pengpeng Hou wrote:
> Channel allocation ignores a required clock failure and does not reject
> a failed TCD DMA-pool allocation before requesting IRQ resources.
>
> Check both prerequisites and unwind only the channel clock that was
> enabled by this allocation attempt.
>
> Fixes: 9d831528a656 ("dmaengine: fsl-edma: extract common fsl-edma code (no changes in behavior intended)")
> Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
> ---
> drivers/dma/fsl-edma-common.c | 15 ++++++++++++---
> 1 file changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c
> index bb7531c456dfa..02b92d1464cca 100644
> --- a/drivers/dma/fsl-edma-common.c
> +++ b/drivers/dma/fsl-edma-common.c
> @@ -844,13 +844,20 @@ int fsl_edma_alloc_chan_resources(struct dma_chan *chan)
> struct fsl_edma_chan *fsl_chan = to_fsl_edma_chan(chan);
> int ret = 0;
>
> - if (fsl_edma_drvflags(fsl_chan) & FSL_EDMA_DRV_HAS_CHCLK)
> - clk_prepare_enable(fsl_chan->clk);
> + if (fsl_edma_drvflags(fsl_chan) & FSL_EDMA_DRV_HAS_CHCLK) {
Actually check is unnecesary because it is no-ops when clock is NULL.
Joy have did some work
at https://patchwork.kernel.org/project/imx/list/?series=1119587
Joy:
Can you take this patch into your serie to avoid merge conflicts?
Frnak
> + ret = clk_prepare_enable(fsl_chan->clk);
> + if (ret)
> + return ret;
> + }
>
> fsl_chan->tcd_pool = dma_pool_create("tcd_pool", chan->device->dev,
> fsl_edma_drvflags(fsl_chan) & FSL_EDMA_DRV_TCD64 ?
> sizeof(struct fsl_edma_hw_tcd64) : sizeof(struct fsl_edma_hw_tcd),
> 32, 0);
> + if (!fsl_chan->tcd_pool) {
> + ret = -ENOMEM;
> + goto err_pool;
> + }
>
> if (fsl_chan->txirq)
> ret = request_irq(fsl_chan->txirq, fsl_chan->irq_handler, IRQF_SHARED,
> @@ -873,7 +880,9 @@ int fsl_edma_alloc_chan_resources(struct dma_chan *chan)
> free_irq(fsl_chan->txirq, fsl_chan);
> err_txirq:
> dma_pool_destroy(fsl_chan->tcd_pool);
> - clk_disable_unprepare(fsl_chan->clk);
> +err_pool:
> + if (fsl_edma_drvflags(fsl_chan) & FSL_EDMA_DRV_HAS_CHCLK)
> + clk_disable_unprepare(fsl_chan->clk);
>
> return ret;
> }
>
> base-commit: 08dbfad3f5040f5bdb6c529da20d6d4e81fefd72
> --
> 2.50.1
>
>
prev parent reply other threads:[~2026-08-31 15:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-30 14:09 Pengpeng Hou
2026-08-31 15:46 ` Frank Li [this message]
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=apWhyl5RKCtmEbzv@SMW015318 \
--to=frank.li@oss.nxp.com \
--cc=Frank.Li@nxp.com \
--cc=dmaengine@vger.kernel.org \
--cc=imx@lists.linux.dev \
--cc=joy.zou@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pengpeng@iscas.ac.cn \
--cc=vkoul@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®