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

This check 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: 8e6152bc660e ("dmaengine: Add hisilicon k3 DMA engine driver")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 drivers/dma/k3dma.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/dma/k3dma.c b/drivers/dma/k3dma.c
index ecdaada95120..3c2c44efc8f6 100644
--- a/drivers/dma/k3dma.c
+++ b/drivers/dma/k3dma.c
@@ -878,6 +878,8 @@ static int k3_dma_probe(struct platform_device *op)
 	}
 
 	irq = platform_get_irq(op, 0);
+	if (irq < 0)
+		return irq;
 	ret = devm_request_irq(&op->dev, irq,
 			k3_dma_int_handler, 0, DRIVER_NAME, d);
 	if (ret)
-- 
2.17.1


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

only message in thread, other threads:[~2022-01-28 16:27 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:26 [PATCH] dmaengine: k3dma: Add missing IRQ check in k3_dma_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®