[PATCH 2/2 v3] misc: atmel-ssc: Fix platform_get_irq's error checking

From
Alexandre Belloni <hidden>
Date
2017-11-19 08:39:35
Also in
lkml
Reply to
Arvind Yadav, 2017-11-19
On 19/11/2017 at 10:04:01 +0530, Arvind Yadav wrote:
The platform_get_irq() function returns negative if an error occurs.
zero or positive number on success. platform_get_irq() error checking
for zero is not correct.

Signed-off-by: Arvind Yadav <redacted>
---
changes in v2 :
              Add failure case '<= 0' instead of '< 0'. IRQ 0 is not valid.
changes in v3:
              Return -ENODEV instead of ssc->irq.
The patch is not doing what you claim here.

quoted hunk ↗ jump to hunk
 drivers/misc/atmel-ssc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c
index b2a0340..2ec0f9e 100644
--- a/drivers/misc/atmel-ssc.c
+++ b/drivers/misc/atmel-ssc.c
@@ -235,7 +235,7 @@ static int ssc_probe(struct platform_device *pdev)
 	clk_disable_unprepare(ssc->clk);
 
 	ssc->irq = platform_get_irq(pdev, 0);
-	if (!ssc->irq) {
+	if (ssc->irq <= 0) {
 		dev_dbg(&pdev->dev, "could not get irq\n");
 		return -ENXIO;
 	}
-- 
2.7.4
-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
Thread (5 messages) 5 messages, 3 authors, last reply 2017-11-20
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help