Skip to contentSkip to conversation

dmaengine: mmp_pdma: Fix missing IRQ check in mmp_pdma_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_pdma: Fix missing IRQ check in mmp_pdma_probe

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

Fixes c8acd6aa6bed ("dmaengine: mmp-pdma support")
---
 drivers/dma/mmp_pdma.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/dma/mmp_pdma.c +2 -0
index 5a53d7fcef01..c03f4f7ece88 100644
@@ -1067,6 +1067,8 @@ static int mmp_pdma_probe(struct platform_device *op)
 	if (irq_num != dma_channels) {
 		/* all chan share one irq, demux inside */
 		irq = platform_get_irq(op, 0);
+		if (irq < 0)
+			return irq;
 		ret = devm_request_irq(pdev->dev, irq, mmp_pdma_int_handler,
 				       IRQF_SHARED, "pdma", pdev);
 		if (ret)
Signature · 1 line
2.17.1