All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dmaengine: tegra210-adma: fix of_irq_get() error check
@ 2017-07-30 18:10 Sergei Shtylyov
       [not found] ` <20170730181051.733168837-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Sergei Shtylyov @ 2017-07-30 18:10 UTC (permalink / raw)
  To: Laxman Dewangan, Jon Hunter, Vinod Koul, Thierry Reding,
	dmaengine-u79uwXL29TY76Z2rM5mHXA,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA
  Cc: Dan Williams, Sergei Shtylyov

[-- Attachment #1: dmaengine-tegra210-adma-fix-of_irq_get-error-check.patch --]
[-- Type: text/plain, Size: 1127 bytes --]

of_irq_get() may return 0 as well as negative error number on failure,
while the driver only checks for the negative values. The driver would then
call request_irq(0, ...) in tegra_adma_alloc_chan_resources() and never get
valid channel interrupt.

Check for 'tdc->irq <= 0' instead and return -ENXIO from the driver's probe
iff of_irq_get() returned 0.

Fixes: f46b195799b5 ("dmaengine: tegra-adma: Add support for Tegra210 ADMA")
Signed-off-by: Sergei Shtylyov <sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>

---
 drivers/dma/tegra210-adma.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: slave-dma/drivers/dma/tegra210-adma.c
===================================================================
--- slave-dma.orig/drivers/dma/tegra210-adma.c
+++ slave-dma/drivers/dma/tegra210-adma.c
@@ -717,8 +717,8 @@ static int tegra_adma_probe(struct platf
 		tdc->chan_addr = tdma->base_addr + ADMA_CH_REG_OFFSET(i);
 
 		tdc->irq = of_irq_get(pdev->dev.of_node, i);
-		if (tdc->irq < 0) {
-			ret = tdc->irq;
+		if (tdc->irq <= 0) {
+			ret = tdc->irq ?: -ENXIO;
 			goto irq_dispose;
 		}
 

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-08-09  6:10 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-30 18:10 [PATCH] dmaengine: tegra210-adma: fix of_irq_get() error check Sergei Shtylyov
     [not found] ` <20170730181051.733168837-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
2017-07-30 19:46   ` Sergei Shtylyov
2017-07-31  9:30   ` Thierry Reding
2017-07-31  9:57     ` Sergei Shtylyov
     [not found]       ` <0102e75c-d1be-e274-808b-f9d3f434924d-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
2017-07-31 12:59         ` Sergei Shtylyov
     [not found]           ` <49996233-5ccd-58e6-db00-b5d402ff6e74-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
2017-07-31 16:56             ` Thierry Reding
2017-07-31 17:07               ` Sergei Shtylyov
2017-07-31 20:11               ` Jon Hunter
2017-08-09  6:10   ` Vinod Koul

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.