mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] platform: don't return 0 from platform_get_irq[_byname]() on error
@ 2016-05-28 20:51 Sergei Shtylyov
  2016-06-10 12:11 ` Sergei Shtylyov
  0 siblings, 1 reply; 2+ messages in thread
From: Sergei Shtylyov @ 2016-05-28 20:51 UTC (permalink / raw)
  To: gregkh, linux-kernel

of_irq_get[_byname]() return 0 iff irq_create_of_mapping() call fails.
Returning both  error code and 0 on failure is a sign of a misdesigned API.
We  should rely on the platform IRQ resource in this case, not return 0,
especially as 0 can be a valid  IRQ resource too...

Fixes: aff008ad813c ("platform_get_irq: Revert to platform_get_resource if of_irq_get fails")
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
CC: stable@vger.kernel.org

---
The patch is against the 'driver-core-linus' branch of Greg KH's
'driver-core.git' repo.

 drivers/base/platform.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: driver-core/drivers/base/platform.c
===================================================================
--- driver-core.orig/drivers/base/platform.c
+++ driver-core/drivers/base/platform.c
@@ -97,7 +97,7 @@ int platform_get_irq(struct platform_dev
 		int ret;
 
 		ret = of_irq_get(dev->dev.of_node, num);
-		if (ret >= 0 || ret == -EPROBE_DEFER)
+		if (ret > 0 || ret == -EPROBE_DEFER)
 			return ret;
 	}
 
@@ -175,7 +175,7 @@ int platform_get_irq_byname(struct platf
 		int ret;
 
 		ret = of_irq_get_byname(dev->dev.of_node, name);
-		if (ret >= 0 || ret == -EPROBE_DEFER)
+		if (ret > 0 || ret == -EPROBE_DEFER)
 			return ret;
 	}
 

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

end of thread, other threads:[~2016-06-10 12:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-28 20:51 [PATCH] platform: don't return 0 from platform_get_irq[_byname]() on error Sergei Shtylyov
2016-06-10 12:11 ` Sergei Shtylyov

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®