Skip to contentSkip to conversation

dmaengine: mmp_tdma: Add missing IRQ check in mmp_tdma_probe

PATCH New Miaoqian Lin 1 participant 1 message Jan 28, 2022 dmaengine

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dmaengine: mmp_tdma: Add missing IRQ check in mmp_tdma_probe

This func misses checking for platform_get_irq()'s call and may passes the negative error codes to devm_request_irq(), which takes unsigned IRQ #, causing it to fail with -EINVAL, overriding an original error code. Stop calling devm_request_irq() with invalid IRQ #s.

Fixes f1a7757008b8 ("dmaengine: mmp_tdma: add dt support")
---
 drivers/dma/mmp_tdma.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/dma/mmp_tdma.c +2 -0
index a262e0eb4cc9..68f533ff7711 100644
@@ -681,6 +681,8 @@ static int mmp_tdma_probe(struct platform_device *pdev)
 
 	if (irq_num != chan_num) {
 		irq = platform_get_irq(pdev, 0);
+		if (irq < 0)
+			return irq;
 		ret = devm_request_irq(&pdev->dev, irq,
 			mmp_tdma_int_handler, IRQF_SHARED, "tdma", tdev);
 		if (ret)
Signature · 1 line
2.17.1