mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] dmaengine: mmp_tdma: Add missing IRQ check in mmp_tdma_probe
@ 2022-01-28 16:23 Miaoqian Lin
  0 siblings, 0 replies; only message in thread
From: Miaoqian Lin @ 2022-01-28 16:23 UTC (permalink / raw)
  To: Vinod Koul, Arnd Bergmann, Zhangfei Gao, dmaengine, linux-kernel; +Cc: linmq006

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")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 drivers/dma/mmp_tdma.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/dma/mmp_tdma.c b/drivers/dma/mmp_tdma.c
index a262e0eb4cc9..68f533ff7711 100644
--- a/drivers/dma/mmp_tdma.c
+++ b/drivers/dma/mmp_tdma.c
@@ -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)
-- 
2.17.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-01-28 16:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-28 16:23 [PATCH] dmaengine: mmp_tdma: Add missing IRQ check in mmp_tdma_probe Miaoqian Lin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®