Message ID | 20241115105629.748390-2-peng.fan@oss.nxp.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [V3,1/2] dmaengine: fsl-edma: cleanup chan after dma_async_device_unregister | expand |
On Fri, Nov 15, 2024 at 06:56:29PM +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. Otherwise there will be kernel dump: Nik: Add fsl_edma->txirq/errirq check to avoid below warning because no errirq at i.MX9 platform. Reviewed-by: Frank Li <Frank.Li@nxp.com> > WARNING: CPU: 0 PID: 11 at kernel/irq/devres.c:144 devm_free_irq+0x74/0x80 > Modules linked in: > CPU: 0 UID: 0 PID: 11 Comm: kworker/u8:0 Not tainted 6.12.0-rc7#18 > Hardware name: NXP i.MX93 11X11 EVK board (DT) > Workqueue: events_unbound deferred_probe_work_func > pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) > pc : devm_free_irq+0x74/0x80 > lr : devm_free_irq+0x48/0x80 > Call trace: > devm_free_irq+0x74/0x80 (P) > devm_free_irq+0x48/0x80 (L) > fsl_edma_remove+0xc4/0xc8 > platform_remove+0x28/0x44 > device_remove+0x4c/0x80 > > Fixes: 44eb827264de ("dmaengine: fsl-edma: request per-channel IRQ only when channel is allocated") > Signed-off-by: Peng Fan <peng.fan@nxp.com> > --- > V3: > Update commit log > V2: > None > > 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 3966320c3d73..03b684d7358c 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; > fsl_edma->drvdata = drvdata; > fsl_edma->n_chans = chans; > mutex_init(&fsl_edma->fsl_edma_mutex); > -- > 2.37.1 >
> Subject: Re: [PATCH V3 2/2] dmaengine: fsl-edma: free irq correctly in > remove path > > On Fri, Nov 15, 2024 at 06:56:29PM +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. Otherwise there will be kernel > dump: > > Nik: > > Add fsl_edma->txirq/errirq check to avoid below warning because no > errirq at i.MX9 platform. > > Reviewed-by: Frank Li <Frank.Li@nxp.com> Thanks, since this is minor commit update. Not sure Vinok could help to update, or need me to update and send v4. Thanks, Peng. > > > WARNING: CPU: 0 PID: 11 at kernel/irq/devres.c:144 > > devm_free_irq+0x74/0x80 Modules linked in: > > CPU: 0 UID: 0 PID: 11 Comm: kworker/u8:0 Not tainted 6.12.0- > rc7#18 > > Hardware name: NXP i.MX93 11X11 EVK board (DT) > > Workqueue: events_unbound deferred_probe_work_func > > pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) > pc : > > devm_free_irq+0x74/0x80 lr : devm_free_irq+0x48/0x80 Call trace: > > devm_free_irq+0x74/0x80 (P) > > devm_free_irq+0x48/0x80 (L) > > fsl_edma_remove+0xc4/0xc8 > > platform_remove+0x28/0x44 > > device_remove+0x4c/0x80 > > > > Fixes: 44eb827264de ("dmaengine: fsl-edma: request per-channel > IRQ > > only when channel is allocated") > > Signed-off-by: Peng Fan <peng.fan@nxp.com> > > --- > > V3: > > Update commit log > > V2: > > None > > > > 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 3966320c3d73..03b684d7358c 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; > > fsl_edma->drvdata = drvdata; > > fsl_edma->n_chans = chans; > > mutex_init(&fsl_edma->fsl_edma_mutex); > > -- > > 2.37.1 > >
diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c index 3966320c3d73..03b684d7358c 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; fsl_edma->drvdata = drvdata; fsl_edma->n_chans = chans; mutex_init(&fsl_edma->fsl_edma_mutex);