Commit 3fc96b9e authored by Sergei Shtylyov's avatar Sergei Shtylyov Committed by Greg Kroah-Hartman

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

commit e330b9a6 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: aff008ad ("platform_get_irq: Revert to platform_get_resource if of_irq_get fails")
Signed-off-by: default avatarSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e7837af6
...@@ -96,7 +96,7 @@ int platform_get_irq(struct platform_device *dev, unsigned int num) ...@@ -96,7 +96,7 @@ int platform_get_irq(struct platform_device *dev, unsigned int num)
int ret; int ret;
ret = of_irq_get(dev->dev.of_node, num); ret = of_irq_get(dev->dev.of_node, num);
if (ret >= 0 || ret == -EPROBE_DEFER) if (ret > 0 || ret == -EPROBE_DEFER)
return ret; return ret;
} }
...@@ -154,7 +154,7 @@ int platform_get_irq_byname(struct platform_device *dev, const char *name) ...@@ -154,7 +154,7 @@ int platform_get_irq_byname(struct platform_device *dev, const char *name)
int ret; int ret;
ret = of_irq_get_byname(dev->dev.of_node, name); ret = of_irq_get_byname(dev->dev.of_node, name);
if (ret >= 0 || ret == -EPROBE_DEFER) if (ret > 0 || ret == -EPROBE_DEFER)
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment