diff mbox

omap2: off by 1

Message ID 49A5425C.9050405@gmail.com (mailing list archive)
State Awaiting Upstream, archived
Headers show

Commit Message

Roel Kluin Feb. 25, 2009, 1:06 p.m. UTC
with while (i++ < MAX_CLOCK_ENABLE_WAIT); i can reach MAX_CLOCK_ENABLE_WAIT + 1
after the loop, so if (i == MAX_CLOCK_ENABLE_WAIT) that's still success.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
 arch/arm/mach-omap2/clock.c       |    2 +-
 arch/arm/mach-omap2/powerdomain.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Paul Walmsley May 14, 2009, 9:15 p.m. UTC | #1
On Wed, 25 Feb 2009, Roel Kluin wrote:

> with while (i++ < MAX_CLOCK_ENABLE_WAIT); i can reach MAX_CLOCK_ENABLE_WAIT + 1
> after the loop, so if (i == MAX_CLOCK_ENABLE_WAIT) that's still success.

Hi Roel

it's a worst-case bailout value that is significantly larger than it needs 
to be, so being off by 1 doesn't matter here.  But I'll take the patch on 
pedantic grounds.  Queued in the omap-clocks-upstream branch.

- Paul

> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
>  arch/arm/mach-omap2/clock.c       |    2 +-
>  arch/arm/mach-omap2/powerdomain.c |    2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
> index ce4d46a..da185ff 100644
> --- a/arch/arm/mach-omap2/clock.c
> +++ b/arch/arm/mach-omap2/clock.c
> @@ -202,7 +202,7 @@ int omap2_wait_clock_ready(void __iomem *reg, u32 mask, const char *name)
>  		udelay(1);
>  	}
>  
> -	if (i < MAX_CLOCK_ENABLE_WAIT)
> +	if (i <= MAX_CLOCK_ENABLE_WAIT)
>  		pr_debug("Clock %s stable after %d loops\n", name, i);
>  	else
>  		printk(KERN_ERR "Clock %s didn't enable in %d tries\n",
> diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
> index 73e2971..983f1cb 100644
> --- a/arch/arm/mach-omap2/powerdomain.c
> +++ b/arch/arm/mach-omap2/powerdomain.c
> @@ -1099,7 +1099,7 @@ int pwrdm_wait_transition(struct powerdomain *pwrdm)
>  	       (c++ < PWRDM_TRANSITION_BAILOUT))
>  		udelay(1);
>  
> -	if (c >= PWRDM_TRANSITION_BAILOUT) {
> +	if (c > PWRDM_TRANSITION_BAILOUT) {
>  		printk(KERN_ERR "powerdomain: waited too long for "
>  		       "powerdomain %s to complete transition\n", pwrdm->name);
>  		return -EAGAIN;
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


- Paul
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index ce4d46a..da185ff 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -202,7 +202,7 @@  int omap2_wait_clock_ready(void __iomem *reg, u32 mask, const char *name)
 		udelay(1);
 	}
 
-	if (i < MAX_CLOCK_ENABLE_WAIT)
+	if (i <= MAX_CLOCK_ENABLE_WAIT)
 		pr_debug("Clock %s stable after %d loops\n", name, i);
 	else
 		printk(KERN_ERR "Clock %s didn't enable in %d tries\n",
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
index 73e2971..983f1cb 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -1099,7 +1099,7 @@  int pwrdm_wait_transition(struct powerdomain *pwrdm)
 	       (c++ < PWRDM_TRANSITION_BAILOUT))
 		udelay(1);
 
-	if (c >= PWRDM_TRANSITION_BAILOUT) {
+	if (c > PWRDM_TRANSITION_BAILOUT) {
 		printk(KERN_ERR "powerdomain: waited too long for "
 		       "powerdomain %s to complete transition\n", pwrdm->name);
 		return -EAGAIN;