From: Frank Li <Frank.li@nxp.com>
To: "Peng Fan (OSS)" <peng.fan@oss.nxp.com>
Cc: Vinod Koul <vkoul@kernel.org>,
"open list:FREESCALE eDMA DRIVER" <imx@lists.linux.dev>,
"open list:FREESCALE eDMA DRIVER" <dmaengine@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>,
Peng Fan <peng.fan@nxp.com>
Subject: Re: [PATCH 2/2] dmaengine: fsl-edma: free irq correctly in remove pathy
Date: Fri, 1 Nov 2024 14:29:21 -0400 [thread overview]
Message-ID: <ZyUeAc6rNbGDLKfO@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20241101101410.1449891-2-peng.fan@oss.nxp.com>
On Fri, Nov 01, 2024 at 06:14:10PM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
>
> To i.MX9, there is no valid fsl_edma->txirq/errirq, so add a check in
> fsl_edma_irq_exit to avoid issues.
>
> Fixes: 44eb827264de ("dmaengine: fsl-edma: request per-channel IRQ only when channel is allocated")
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
> drivers/dma/fsl-edma-main.c | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c
> index 01bd5cb24a49..89c54eeb4925 100644
> --- a/drivers/dma/fsl-edma-main.c
> +++ b/drivers/dma/fsl-edma-main.c
> @@ -303,6 +303,7 @@ fsl_edma2_irq_init(struct platform_device *pdev,
>
> /* The last IRQ is for eDMA err */
> if (i == count - 1) {
> + fsl_edma->errirq = irq;
> ret = devm_request_irq(&pdev->dev, irq,
> fsl_edma_err_handler,
> 0, "eDMA2-ERR", fsl_edma);
> @@ -322,10 +323,13 @@ static void fsl_edma_irq_exit(
> struct platform_device *pdev, struct fsl_edma_engine *fsl_edma)
> {
> if (fsl_edma->txirq == fsl_edma->errirq) {
> - devm_free_irq(&pdev->dev, fsl_edma->txirq, fsl_edma);
> + if (fsl_edma->txirq >= 0)
> + devm_free_irq(&pdev->dev, fsl_edma->txirq, fsl_edma);
> } else {
> - devm_free_irq(&pdev->dev, fsl_edma->txirq, fsl_edma);
> - devm_free_irq(&pdev->dev, fsl_edma->errirq, fsl_edma);
> + if (fsl_edma->txirq >= 0)
> + devm_free_irq(&pdev->dev, fsl_edma->txirq, fsl_edma);
> + if (fsl_edma->errirq >= 0)
> + devm_free_irq(&pdev->dev, fsl_edma->errirq, fsl_edma);
> }
> }
>
> @@ -485,6 +489,8 @@ static int fsl_edma_probe(struct platform_device *pdev)
> if (!fsl_edma)
> return -ENOMEM;
>
> + fsl_edma->errirq = -EINVAL;
> + fsl_edma->txirq = -EINVAL;
why not use 0 as invalidate?
Frank
> fsl_edma->drvdata = drvdata;
> fsl_edma->n_chans = chans;
> mutex_init(&fsl_edma->fsl_edma_mutex);
> --
> 2.37.1
>
next prev parent reply other threads:[~2024-11-01 18:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-01 10:14 [PATCH 1/2] dmaengine: fsl-edma: cleanup chan after dma_async_device_unregister Peng Fan (OSS)
2024-11-01 10:14 ` [PATCH 2/2] dmaengine: fsl-edma: free irq correctly in remove path Peng Fan (OSS)
2024-11-01 18:29 ` Frank Li [this message]
2024-11-04 3:13 ` [PATCH 2/2] dmaengine: fsl-edma: free irq correctly in remove pathy Peng Fan
2024-11-01 18:27 ` [PATCH 1/2] dmaengine: fsl-edma: cleanup chan after dma_async_device_unregister Frank Li
2024-11-04 5:35 ` Peng Fan
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=ZyUeAc6rNbGDLKfO@lizhi-Precision-Tower-5810 \
--to=frank.li@nxp.com \
--cc=dmaengine@vger.kernel.org \
--cc=imx@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=peng.fan@nxp.com \
--cc=peng.fan@oss.nxp.com \
--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®