net: fsl: Don't use NO_IRQ to check return value of irq_of_parse_and_map()
PATCH 1/2 net: fsl: Don't use NO_IRQ to check return value of irq_of_parse_and_map()
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.
--- drivers/net/ethernet/freescale/gianfar.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/freescale/gianfar.c +3 -3
@@ -647,9 +647,9 @@ static int gfar_parse_group(struct device_node *np,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,TX )->irq || + !gfar_irq (grp,RX )->irq || + !gfar_irq (grp,ER )->irq)return -EINVAL ; }
Signature · 1 line
2.6.2
PATCH 2/2 net: fsl: Fix error checking for platform_get_irq()
The gianfar driver has recently been enabled on arm64 but fails to build since it check the return value of platform_get_irq() against NO_IRQ. Fix this by instead checking for a negative error code.
Even on ARM where this code was previously being built this check was incorrect since platform_get_irq() returns a negative error code which may not be exactly the (unsigned int)(-1) that NO_IRQ is defined to be.
--- drivers/net/ethernet/freescale/gianfar_ptp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/freescale/gianfar_ptp.c +1 -1
@@ -467,7 +467,7 @@ static int gianfar_ptp_probe(struct platform_device *dev) etsects->irq =platform_get_irq (dev,0 ); -if (etsects->irq ==NO_IRQ ) { +if (etsects->irq <0 ) {pr_err ("irq not in device tree\n" ); goto no_node; }
Signature · 1 line
2.6.2
Re: [PATCH 2/2] net: fsl: Fix error checking for platform_get_irq()
From: Mark Brown <[email protected]>
Date: Thu, 26 Nov 2015 11:59:46 +0000
Quoted 9 lines
The gianfar driver has recently been enabled on arm64 but fails to build since it check the return value of
platform_get_irq()againstNO_IRQ. Fix this by instead checking for a negative error code.Even on ARM where this code was previously being built this check was incorrect since
platform_get_irq()returns a negative error code which may not be exactly the (unsigned int)(-1) thatNO_IRQis defined to be.Signed-off-by Mark Brown <[email protected]>
Applied.
PATCH v2 1/1 gianfar: Don't use NO_IRQ to check return value of irq_of_parse_and_map()
In reply to Mark BrownFrom: Mark Brown <[email protected]>
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.
---
v2: even better, do the obvious tx handling fix
drivers/net/ethernet/freescale/gianfar.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/freescale/gianfar.c +3 -3
@@ -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 ; }
Signature · 1 line
1.7.11.7
Quoted 15 lines
-----Original Message-----
From: Mark Brown [mailto:[email protected]]
Sent: Thursday, November 26, 2015 2:00 PM
To: Manoil Claudiu-B08782 <[email protected]>; Xie Shaohui- B21989 <[email protected]>; David S . Miller <[email protected]>
Cc: [email protected]; Mark Brown <[email protected]>
Subject: [PATCH 1/2] net: fsl: Don't useNO_IRQto check return value ofirq_of_parse_and_map()This driver can be built on arm64 but relies on
NO_IRQto check the return value ofirq_of_parse_and_map()which fails to build on arm64 because the architecture does not provide aNO_IRQ. Fix this to correctly check the return value ofirq_of_parse_and_map().
Quoted 5 lines
Even on ARM systems where the driver was previously used the check was broken since on ARM
NO_IRQis -1 butirq_of_parse_and_map()returns 0 on error.Signed-off-by Mark Brown <[email protected]>
Ack.
Suggesting the v2 patch below instead, adding a missing fix:
http://patchwork.ozlabs.org/patch/549126/
("[net,v2] gianfar: Don't use NO_IRQ to check return value of irq_of_parse_and_map()")
Thanks,
Claudiu
From: Mark Brown <[email protected]>
Date: Thu, 26 Nov 2015 11:59:45 +0000
Quoted 10 lines
This driver can be built on arm64 but relies on
NO_IRQto check the return value ofirq_of_parse_and_map()which fails to build on arm64 because the architecture does not provide aNO_IRQ. Fix this to correctly check the return value ofirq_of_parse_and_map().Even on ARM systems where the driver was previously used the check was broken since on ARM
NO_IRQis -1 butirq_of_parse_and_map()returns 0 on error.Signed-off-by Mark Brown <[email protected]>
Applied.