stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Patch "platform: don't return 0 from platform_get_irq[_byname]() on error" has been added to the 4.7-stable tree
@ 2016-10-25 19:03 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2016-10-25 19:03 UTC (permalink / raw)
  To: sergei.shtylyov, gregkh; +Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    platform: don't return 0 from platform_get_irq[_byname]() on error

to the 4.7-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     platform-don-t-return-0-from-platform_get_irq-on-error.patch
and it can be found in the queue-4.7 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From e330b9a6bb35dc7097a4f02cb1ae7b6f96df92af Mon Sep 17 00:00:00 2001
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Date: Mon, 4 Jul 2016 01:04:24 +0300
Subject: platform: don't return 0 from platform_get_irq[_byname]() on error

From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

commit e330b9a6bb35dc7097a4f02cb1ae7b6f96df92af upstream.

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,
it makes the failure check unnecessarily complex and error prone. 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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

--- a/drivers/base/platform.c
+++ b/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;
 	}
 


Patches currently in stable-queue which might be from sergei.shtylyov@cogentembedded.com are

queue-4.7/platform-don-t-return-0-from-platform_get_irq-on-error.patch

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

only message in thread, other threads:[~2016-10-25 19:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-25 19:03 Patch "platform: don't return 0 from platform_get_irq[_byname]() on error" has been added to the 4.7-stable tree gregkh

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).