All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] net: fsl: Don't use NO_IRQ to check return value of irq_of_parse_and_map()
@ 2015-11-26 11:59 Mark Brown
  2015-11-26 11:59 ` [PATCH 2/2] net: fsl: Fix error checking for platform_get_irq() Mark Brown
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Mark Brown @ 2015-11-26 11:59 UTC (permalink / raw)
  To: Claudiu Manoil, Shaohui Xie, David S . Miller; +Cc: netdev, Mark Brown

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>
---
 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 67b1850c034e..4ce60e0c8341 100644
--- a/drivers/net/ethernet/freescale/gianfar.c
+++ b/drivers/net/ethernet/freescale/gianfar.c
@@ -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;
 	}
 
-- 
2.6.2

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] net: fsl: Fix error checking for platform_get_irq()
  2015-11-26 11:59 [PATCH 1/2] net: fsl: Don't use NO_IRQ to check return value of irq_of_parse_and_map() Mark Brown
@ 2015-11-26 11:59 ` Mark Brown
  2015-11-30 20:20   ` David Miller
  2015-11-26 14:01 ` [PATCH net v2] gianfar: Don't use NO_IRQ to check return value of irq_of_parse_and_map() Claudiu Manoil
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: Mark Brown @ 2015-11-26 11:59 UTC (permalink / raw)
  To: Claudiu Manoil, Shaohui Xie, David S . Miller; +Cc: netdev, Mark Brown

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.

Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/net/ethernet/freescale/gianfar_ptp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/freescale/gianfar_ptp.c b/drivers/net/ethernet/freescale/gianfar_ptp.c
index 664d0c261269..b40fba929d65 100644
--- a/drivers/net/ethernet/freescale/gianfar_ptp.c
+++ b/drivers/net/ethernet/freescale/gianfar_ptp.c
@@ -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;
 	}
-- 
2.6.2

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net v2] gianfar: Don't use NO_IRQ to check return value of irq_of_parse_and_map()
  2015-11-26 11:59 [PATCH 1/2] net: fsl: Don't use NO_IRQ to check return value of irq_of_parse_and_map() Mark Brown
  2015-11-26 11:59 ` [PATCH 2/2] net: fsl: Fix error checking for platform_get_irq() Mark Brown
@ 2015-11-26 14:01 ` Claudiu Manoil
  2015-11-26 15:18 ` [PATCH 1/2] net: fsl: " Manoil Claudiu
  2015-11-30 20:20 ` David Miller
  3 siblings, 0 replies; 6+ messages in thread
From: Claudiu Manoil @ 2015-11-26 14:01 UTC (permalink / raw)
  To: netdev; +Cc: David S . Miller, Mark Brown

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 <claudiu.manoil@freescale.com>
---
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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* RE: [PATCH 1/2] net: fsl: Don't use NO_IRQ to check return value of irq_of_parse_and_map()
  2015-11-26 11:59 [PATCH 1/2] net: fsl: Don't use NO_IRQ to check return value of irq_of_parse_and_map() Mark Brown
  2015-11-26 11:59 ` [PATCH 2/2] net: fsl: Fix error checking for platform_get_irq() Mark Brown
  2015-11-26 14:01 ` [PATCH net v2] gianfar: Don't use NO_IRQ to check return value of irq_of_parse_and_map() Claudiu Manoil
@ 2015-11-26 15:18 ` Manoil Claudiu
  2015-11-30 20:20 ` David Miller
  3 siblings, 0 replies; 6+ messages in thread
From: Manoil Claudiu @ 2015-11-26 15:18 UTC (permalink / raw)
  To: David S . Miller; +Cc: netdev, Mark Brown, Shaohui Xie

>-----Original Message-----
>From: Mark Brown [mailto:broonie@kernel.org]
>Sent: Thursday, November 26, 2015 2:00 PM
>To: Manoil Claudiu-B08782 <claudiu.manoil@freescale.com>; Xie Shaohui-
>B21989 <Shaohui.Xie@freescale.com>; David S . Miller
><davem@davemloft.net>
>Cc: netdev@vger.kernel.org; Mark Brown <broonie@kernel.org>
>Subject: [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.
>
>Signed-off-by: Mark Brown <broonie@kernel.org>

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] net: fsl: Don't use NO_IRQ to check return value of irq_of_parse_and_map()
  2015-11-26 11:59 [PATCH 1/2] net: fsl: Don't use NO_IRQ to check return value of irq_of_parse_and_map() Mark Brown
                   ` (2 preceding siblings ...)
  2015-11-26 15:18 ` [PATCH 1/2] net: fsl: " Manoil Claudiu
@ 2015-11-30 20:20 ` David Miller
  3 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2015-11-30 20:20 UTC (permalink / raw)
  To: broonie; +Cc: claudiu.manoil, Shaohui.Xie, netdev

From: Mark Brown <broonie@kernel.org>
Date: Thu, 26 Nov 2015 11:59:45 +0000

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

Applied.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] net: fsl: Fix error checking for platform_get_irq()
  2015-11-26 11:59 ` [PATCH 2/2] net: fsl: Fix error checking for platform_get_irq() Mark Brown
@ 2015-11-30 20:20   ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2015-11-30 20:20 UTC (permalink / raw)
  To: broonie; +Cc: claudiu.manoil, Shaohui.Xie, netdev

From: Mark Brown <broonie@kernel.org>
Date: Thu, 26 Nov 2015 11:59:46 +0000

> 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.
> 
> Signed-off-by: Mark Brown <broonie@kernel.org>

Applied.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-11-30 20:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-26 11:59 [PATCH 1/2] net: fsl: Don't use NO_IRQ to check return value of irq_of_parse_and_map() Mark Brown
2015-11-26 11:59 ` [PATCH 2/2] net: fsl: Fix error checking for platform_get_irq() Mark Brown
2015-11-30 20:20   ` David Miller
2015-11-26 14:01 ` [PATCH net v2] gianfar: Don't use NO_IRQ to check return value of irq_of_parse_and_map() Claudiu Manoil
2015-11-26 15:18 ` [PATCH 1/2] net: fsl: " Manoil Claudiu
2015-11-30 20:20 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.