Thread (6 messages) 6 messages, 3 authors, 2015-11-30
STALE3850d

[PATCH net v2] gianfar: Don't use NO_IRQ to check return value of irq_of_parse_and_map()

From: Claudiu Manoil <hidden>
Date: 2015-11-26 14:36:44
Subsystem: freescale etsec ethernet driver (gianfar), networking drivers, the rest · Maintainers: Claudiu Manoil, Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

From: Mark Brown <broonie@kernel.org>

This driver can be built on arm64 but relies on NO_IRQ to check the return
value of irq_of_parse_and_map() which fails to build on arm64 because the
architecture does not provide a NO_IRQ. Fix this to correctly check the
return value of irq_of_parse_and_map().

Even on ARM systems where the driver was previously used the check was
broken since on ARM NO_IRQ is -1 but irq_of_parse_and_map() returns 0 on
error.

Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Claudiu Manoil <redacted>
---
v2: even better, do the obvious tx handling fix

 drivers/net/ethernet/freescale/gianfar.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
index 3e6b9b4..5fdd2e7 100644
--- a/drivers/net/ethernet/freescale/gianfar.c
+++ b/drivers/net/ethernet/freescale/gianfar.c
@@ -642,14 +642,14 @@ static int gfar_parse_group(struct device_node *np,
 		return -ENOMEM;
 
 	gfar_irq(grp, TX)->irq = irq_of_parse_and_map(np, 0);
+	if (!gfar_irq(grp, TX)->irq)
+		return -EINVAL;
 
 	/* If we aren't the FEC we have multiple interrupts */
 	if (model && strcasecmp(model, "FEC")) {
 		gfar_irq(grp, RX)->irq = irq_of_parse_and_map(np, 1);
 		gfar_irq(grp, ER)->irq = irq_of_parse_and_map(np, 2);
-		if (gfar_irq(grp, TX)->irq == NO_IRQ ||
-		    gfar_irq(grp, RX)->irq == NO_IRQ ||
-		    gfar_irq(grp, ER)->irq == NO_IRQ)
+		if (!gfar_irq(grp, RX)->irq || !gfar_irq(grp, ER)->irq)
 			return -EINVAL;
 	}
 
-- 
1.7.11.7
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help