Re: [PATCHv4 13/15] dmaengine: fsldma: replace irq_of_parse_and_map with of_irq_get
From: Frank Li
Date: Thu Jun 11 2026 - 11:43:00 EST
On Wed, Jun 10, 2026 at 08:52:43PM -0700, Rosen Penev wrote:
> Use of_irq_get() which returns a negative error code on failure
> instead of silently returning 0. Split the IRQ validation check
> in fsldma_request_irqs to handle three cases:
>
> - chan->irq < 0: propagate the error (e.g. -EPROBE_DEFER)
> - chan->irq == 0: IRQ not found, return -ENODEV
> - chan->irq > 0: valid IRQ, proceed
>
> The fsldma_free_irqs() function's !chan->irq check is unchanged
> since both 0 and negative values mean no IRQ to free.
>
> Assisted-by: opencode:big-pickle
> Signed-off-by: Rosen Penev <rosenp@xxxxxxxxx>
> ---
Reviewed-by: Frank Li <Frank.Li@xxxxxxx>
> drivers/dma/fsldma.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c
> index dc70a6bf5723..0ee3d719ae95 100644
> --- a/drivers/dma/fsldma.c
> +++ b/drivers/dma/fsldma.c
> @@ -1070,6 +1070,12 @@ static int fsldma_request_irqs(struct fsldma_device *fdev)
> if (!chan)
> continue;
>
> + if (chan->irq < 0) {
> + if (chan->irq != -EPROBE_DEFER)
> + chan_err(chan, "interrupts property missing in device tree\n");
> + ret = chan->irq;
> + goto out_unwind;
> + }
> if (!chan->irq) {
> chan_err(chan, "interrupts property missing in device tree\n");
> ret = -ENODEV;
> @@ -1093,7 +1099,7 @@ static int fsldma_request_irqs(struct fsldma_device *fdev)
> if (!chan)
> continue;
>
> - if (!chan->irq)
> + if (chan->irq <= 0)
> continue;
>
> free_irq(chan->irq, chan);
> @@ -1178,7 +1184,7 @@ static int fsl_dma_chan_probe(struct fsldma_device *fdev,
> dma_cookie_init(&chan->common);
>
> /* find the IRQ line, if it exists in the device tree */
> - chan->irq = irq_of_parse_and_map(node, 0);
> + chan->irq = of_irq_get(node, 0);
>
> /* Add the channel to DMA device channel list */
> list_add_tail(&chan->common.device_node, &fdev->common.channels);
> --
> 2.54.0
>