Skip to contentSkip to conversation

of: irq: fix of_irq_to_resource() error check

PATCH Applied Sergei Shtylyov 2 participants 2 messages Jul 21, 2017 1 message not in the archive Device tree

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 of: irq: fix of_irq_to_resource() error check

of_irq_to_resource() has recently been fixed to return negative error #'s along with 0, however of_irq_to_resource_table() still only regards 0 as invalid IRQ -- fix it up.

Fixes 7a4228bbff76 ("of: irq: use of_irq_get() in of_irq_to_resource()")

---
The patch is against the 'dt/linus' branch of Rob Herring's 'linux.git' repo.

 drivers/of/irq.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/of/irq.c +1 -1
Index: linux/drivers/of/irq.c
===================================================================
@@ -476,7 +476,7 @@ int of_irq_to_resource_table(struct devi
 	int i;
 
 	for (i = 0; i < nr_irqs; i++, res++)
-		if (!of_irq_to_resource(dev, i, res))
+		if (of_irq_to_resource(dev, i, res) <= 0)
 			break;
 
 	return i;

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20170721173108.578363976-M4DtvfQ/[email protected]

Applied
#2 lore raw
Quoted 4 lines · Sergei Shtylyov

of_irq_to_resource() has recently been fixed to return negative error #'s along with 0, however of_irq_to_resource_table() still only regards 0 as invalid IRQ -- fix it up.

Quoted 8 lines
Fixes 7a4228bbff76 ("of: irq: use of_irq_get() in of_irq_to_resource()")

---
The patch is against the 'dt/linus' branch of Rob Herring's 'linux.git' repo.

 drivers/of/irq.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied.

BTW, all the users of of_irq_to_resource_table outside of the DT platform code are erroneous IMO. Either the resources are already available when probing or only a single resource is retrieved. These may have been working around a problem that some resources couldn't be resolved at device creation time which is now fixed.

Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html