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 <[email protected]> --- 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 a3792864f02a..7d0c80121aa4 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); @@ -1181,7 +1187,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
