diff mbox

[U-Boot,2/2] tegra: usb: fix wrong error check

Message ID 1338465062-30660-2-git-send-email-dev@lynxeye.de
State Accepted
Headers show

Commit Message

Lucas Stach May 31, 2012, 11:51 a.m. UTC
loop_count runs down from 10000, so the correct condition to error out
is ==0.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Acked-by: Stephen Warren <swarren@wwwdotorg.org>
CC: Stephen Warren <swarren@wwwdotorg.org>
CC: Tom Warren <twarren.nvidia@gmail.com>
---
 arch/arm/cpu/armv7/tegra2/usb.c |    2 +-
 1 Datei geändert, 1 Zeile hinzugefügt(+), 1 Zeile entfernt(-)

Comments

Marek Vasut May 31, 2012, 1:14 p.m. UTC | #1
Dear Lucas Stach,

> loop_count runs down from 10000, so the correct condition to error out
> is ==0.
> 
> Signed-off-by: Lucas Stach <dev@lynxeye.de>
> Acked-by: Stephen Warren <swarren@wwwdotorg.org>
> CC: Stephen Warren <swarren@wwwdotorg.org>
> CC: Tom Warren <twarren.nvidia@gmail.com>
> ---
>  arch/arm/cpu/armv7/tegra2/usb.c |    2 +-
>  1 Datei geändert, 1 Zeile hinzugefügt(+), 1 Zeile entfernt(-)
> 
> diff --git a/arch/arm/cpu/armv7/tegra2/usb.c
> b/arch/arm/cpu/armv7/tegra2/usb.c index c80de7f..5f2b243 100644
> --- a/arch/arm/cpu/armv7/tegra2/usb.c
> +++ b/arch/arm/cpu/armv7/tegra2/usb.c

Why isn't this file in drivers/usb/ ?

> @@ -290,7 +290,7 @@ static int init_usb_controller(struct fdt_usb *config,
>  			break;
>  		udelay(1);
>  	}
> -	if (loop_count == 100000)
> +	if (!loop_count)
>  		return -1;
> 
>  	return 0;

Best regards,
Marek Vasut
Stephen Warren May 31, 2012, 5:44 p.m. UTC | #2
On 05/31/2012 05:51 AM, Lucas Stach wrote:
> loop_count runs down from 10000, so the correct condition to error out
> is ==0.
> 
> Signed-off-by: Lucas Stach <dev@lynxeye.de>
> Acked-by: Stephen Warren <swarren@wwwdotorg.org>
> CC: Stephen Warren <swarren@wwwdotorg.org>
> CC: Tom Warren <twarren.nvidia@gmail.com>

Tested-by: Stephen Warren <swarren@wwwdotorg.org>

On Harmony, repeated invocations of "usb start 0 ; dhcp ${loadaddr}
zImage.uimg" appeared to work OK, with this patch applied to
u-boot-tegra.git master branch.
diff mbox

Patch

diff --git a/arch/arm/cpu/armv7/tegra2/usb.c b/arch/arm/cpu/armv7/tegra2/usb.c
index c80de7f..5f2b243 100644
--- a/arch/arm/cpu/armv7/tegra2/usb.c
+++ b/arch/arm/cpu/armv7/tegra2/usb.c
@@ -290,7 +290,7 @@  static int init_usb_controller(struct fdt_usb *config,
 			break;
 		udelay(1);
 	}
-	if (loop_count == 100000)
+	if (!loop_count)
 		return -1;
 
 	return 0;