Re: [PATCH v2 2/5] dma: mcf-edma: Add per-channel IRQ naming for debugging

Frank Li
2025-12-16T15:38:49Z

On Tue, Dec 16, 2025 at 08:56:01PM +0530, Vinod Koul wrote:
> On 26-11-25, 11:12, Frank Li wrote:
> > On Wed, Nov 26, 2025 at 09:36:03AM +0100, Jean-Michel Hautbois via B4 Relay wrote:
> > > From: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org>
> > >
> > > Add dynamic per-channel IRQ naming to make DMA interrupt identification
> > > easier in /proc/interrupts and debugging tools.
> > >
> > > Instead of all channels showing "eDMA", they now show:
> > > - "eDMA-0" through "eDMA-15" for channels 0-15
> > > - "eDMA-16" through "eDMA-55" for channels 16-55
> > > - "eDMA-tx-56" for the shared channel 56-63 interrupt
> > > - "eDMA-err" for the error interrupt
> > >
> > > This aids debugging DMA issues by making it clear which channel's
> > > interrupt is being serviced.
> > >
> > > Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org>
> > > ---
> > > drivers/dma/mcf-edma-main.c | 26 ++++++++++++++++++--------
> > > 1 file changed, 18 insertions(+), 8 deletions(-)
> > >
> > > diff --git a/drivers/dma/mcf-edma-main.c b/drivers/dma/mcf-edma-main.c
> > > index f95114829d80..6a7d88895501 100644
> > > --- a/drivers/dma/mcf-edma-main.c
> > > +++ b/drivers/dma/mcf-edma-main.c
> > > @@ -81,8 +81,14 @@ static int mcf_edma_irq_init(struct platform_device *pdev,
> > > if (!res)
> > > return -1;
> > >
> > > - for (ret = 0, i = res->start; i <= res->end; ++i)
> > > - ret |= request_irq(i, mcf_edma_tx_handler, 0, "eDMA", mcf_edma);
> > > + for (ret = 0, i = res->start; i <= res->end; ++i) {
> > > + char *irq_name = devm_kasprintf(&pdev->dev, GFP_KERNEL,
> > > + "eDMA-%d", (int)(i - res->start));
> > > + if (!irq_name)
> > > + return -ENOMEM;
> > > +
> > > + ret |= request_irq(i, mcf_edma_tx_handler, 0, irq_name, mcf_edma);
> > > + }
> > > if (ret)
> > > return ret;
> >
> > The existing code have problem, it should use devm_request_irq(). if one
> > irq request failure, return here, requested irq will not free.
>
> Why is that an error!

ret = fsl_edma->drvdata->setup_irq(pdev, fsl_edma);
if (ret)
return ret;

if last one of request_irq() failure, mcf_edma_irq_init() return failure.
probe will return failure also without free irq.

So previous irq by request_irq() is never free at this case.

Frank

>
> >
> > You'd better add patch before this one to change to use devm_request_irq()
>
> Not really, devm_ is a not always good option.
>
> --
> ~Vinod