All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] at91: ohci: fixed broken sanity check
@ 2013-12-31 16:33 ` jjhiblot
  0 siblings, 0 replies; 4+ messages in thread
From: jjhiblot at traphandler.com @ 2013-12-31 16:33 UTC (permalink / raw)
  To: linux-arm-kernel

From: jean-jacques hiblot <jean-jacques.hiblot@jdsu.com>

The test (pdev->resource[1].flags != IORESOURCE_IRQ) is broken because the flags
value may contain not only the information IORESSOURCE_IRQ but also the IRQ type
(IORESOURCE_IRQ_HIGHLEVEL for example).

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@traphandler.com>
---
 drivers/usb/host/ohci-at91.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index 418444e..df9c8a4 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -142,8 +142,8 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver,
 		return -ENODEV;
 	}
 
-	if ((pdev->resource[0].flags != IORESOURCE_MEM)
-			|| (pdev->resource[1].flags != IORESOURCE_IRQ)) {
+	if (!(pdev->resource[0].flags & IORESOURCE_MEM)
+			|| !(pdev->resource[1].flags & IORESOURCE_IRQ)) {
 		pr_debug("hcd probe: invalid resource type\n");
 		return -ENODEV;
 	}
-- 
1.8.4.2

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

* [PATCH] at91: ohci: fixed broken sanity check
@ 2013-12-31 16:33 ` jjhiblot
  0 siblings, 0 replies; 4+ messages in thread
From: jjhiblot @ 2013-12-31 16:33 UTC (permalink / raw)
  To: nicolas.ferre
  Cc: linux-arm-kernel, linux-kernel, jean-jacques hiblot,
	Jean-Jacques Hiblot

From: jean-jacques hiblot <jean-jacques.hiblot@jdsu.com>

The test (pdev->resource[1].flags != IORESOURCE_IRQ) is broken because the flags
value may contain not only the information IORESSOURCE_IRQ but also the IRQ type
(IORESOURCE_IRQ_HIGHLEVEL for example).

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@traphandler.com>
---
 drivers/usb/host/ohci-at91.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index 418444e..df9c8a4 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -142,8 +142,8 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver,
 		return -ENODEV;
 	}
 
-	if ((pdev->resource[0].flags != IORESOURCE_MEM)
-			|| (pdev->resource[1].flags != IORESOURCE_IRQ)) {
+	if (!(pdev->resource[0].flags & IORESOURCE_MEM)
+			|| !(pdev->resource[1].flags & IORESOURCE_IRQ)) {
 		pr_debug("hcd probe: invalid resource type\n");
 		return -ENODEV;
 	}
-- 
1.8.4.2


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

* [PATCH] at91: ohci: fixed broken sanity check
  2013-12-31 16:33 ` jjhiblot
@ 2013-12-31 17:25   ` boris brezillon
  -1 siblings, 0 replies; 4+ messages in thread
From: boris brezillon @ 2013-12-31 17:25 UTC (permalink / raw)
  To: linux-arm-kernel

Hello Jean-Jacques,

On 31/12/2013 17:33, jjhiblot at traphandler.com wrote:
> From: jean-jacques hiblot <jean-jacques.hiblot@jdsu.com>
>
> The test (pdev->resource[1].flags != IORESOURCE_IRQ) is broken because the flags
> value may contain not only the information IORESSOURCE_IRQ but also the IRQ type
> (IORESOURCE_IRQ_HIGHLEVEL for example).
>

This is already fixed: we moved to platform_get_irq and
platform_get_ressource instead of directly accessing platform
resource table.

See http://lists.openwall.net/linux-kernel/2013/12/08/128.

This solves both the problem you're reporting and another problem when
resources are in a different order (nothing guarantees the resources
order when using DT).

Best Regards,

Boris

> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@traphandler.com>
> ---
>   drivers/usb/host/ohci-at91.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
> index 418444e..df9c8a4 100644
> --- a/drivers/usb/host/ohci-at91.c
> +++ b/drivers/usb/host/ohci-at91.c
> @@ -142,8 +142,8 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver,
>   		return -ENODEV;
>   	}
>
> -	if ((pdev->resource[0].flags != IORESOURCE_MEM)
> -			|| (pdev->resource[1].flags != IORESOURCE_IRQ)) {
> +	if (!(pdev->resource[0].flags & IORESOURCE_MEM)
> +			|| !(pdev->resource[1].flags & IORESOURCE_IRQ)) {
>   		pr_debug("hcd probe: invalid resource type\n");
>   		return -ENODEV;
>   	}
>

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

* Re: [PATCH] at91: ohci: fixed broken sanity check
@ 2013-12-31 17:25   ` boris brezillon
  0 siblings, 0 replies; 4+ messages in thread
From: boris brezillon @ 2013-12-31 17:25 UTC (permalink / raw)
  To: jjhiblot, nicolas.ferre
  Cc: jean-jacques hiblot, linux-kernel, linux-arm-kernel

Hello Jean-Jacques,

On 31/12/2013 17:33, jjhiblot@traphandler.com wrote:
> From: jean-jacques hiblot <jean-jacques.hiblot@jdsu.com>
>
> The test (pdev->resource[1].flags != IORESOURCE_IRQ) is broken because the flags
> value may contain not only the information IORESSOURCE_IRQ but also the IRQ type
> (IORESOURCE_IRQ_HIGHLEVEL for example).
>

This is already fixed: we moved to platform_get_irq and
platform_get_ressource instead of directly accessing platform
resource table.

See http://lists.openwall.net/linux-kernel/2013/12/08/128.

This solves both the problem you're reporting and another problem when
resources are in a different order (nothing guarantees the resources
order when using DT).

Best Regards,

Boris

> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@traphandler.com>
> ---
>   drivers/usb/host/ohci-at91.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
> index 418444e..df9c8a4 100644
> --- a/drivers/usb/host/ohci-at91.c
> +++ b/drivers/usb/host/ohci-at91.c
> @@ -142,8 +142,8 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver,
>   		return -ENODEV;
>   	}
>
> -	if ((pdev->resource[0].flags != IORESOURCE_MEM)
> -			|| (pdev->resource[1].flags != IORESOURCE_IRQ)) {
> +	if (!(pdev->resource[0].flags & IORESOURCE_MEM)
> +			|| !(pdev->resource[1].flags & IORESOURCE_IRQ)) {
>   		pr_debug("hcd probe: invalid resource type\n");
>   		return -ENODEV;
>   	}
>


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

end of thread, other threads:[~2013-12-31 17:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-31 16:33 [PATCH] at91: ohci: fixed broken sanity check jjhiblot at traphandler.com
2013-12-31 16:33 ` jjhiblot
2013-12-31 17:25 ` boris brezillon
2013-12-31 17:25   ` boris brezillon

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.