* [PATCH] dmaengine: owl-dma: Add missing IRQ check in owl_dma_probe
@ 2022-01-28 16:37 Miaoqian Lin
  0 siblings, 0 replies; only message in thread
From: Miaoqian Lin @ 2022-01-28 16:37 UTC (permalink / raw)
  To: Vinod Koul, Andreas Färber, Manivannan Sadhasivam, dmaengine,
	linux-arm-kernel, linux-actions, linux-kernel
  Cc: linmq006
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: 47e20577c24d ("dmaengine: Add Actions Semi Owl family S900 DMA driver")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 drivers/dma/owl-dma.c | 5 +++++
 1 file changed, 5 insertions(+)
diff --git a/drivers/dma/owl-dma.c b/drivers/dma/owl-dma.c
index 1f0bbaed4643..09cdaecee635 100644
--- a/drivers/dma/owl-dma.c
+++ b/drivers/dma/owl-dma.c
@@ -1160,6 +1160,11 @@ static int owl_dma_probe(struct platform_device *pdev)
 	 * simplification.
 	 */
 	od->irq = platform_get_irq(pdev, 0);
+	if (od->irq < 0) {
+		dev_err(&pdev->dev, "unable to get IRQ\n");
+		return od->irq;
+	}
+
 	ret = devm_request_irq(&pdev->dev, od->irq, owl_dma_interrupt, 0,
 			       dev_name(&pdev->dev), od);
 	if (ret) {
-- 
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related	[flat|nested] only message in thread
only message in thread, other threads:[~2022-01-28 16:38 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:37 [PATCH] dmaengine: owl-dma: Add missing IRQ check in owl_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;
as well as URLs for NNTP newsgroup(s).