omap2: off by 1
PATCH 1/1 omap2: off by 1
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 <[email protected]>
--- arch/arm/mach-omap2/clock.c | 2 +- arch/arm/mach-omap2/powerdomain.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/clock.c +1 -1
@@ -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",
arch/arm/mach-omap2/powerdomain.c +1 -1
@@ -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 ;
Paul Walmsley
maintainerQuoted 2 lines · Roel Kluin
with while (i++ <
MAX_CLOCK_ENABLE_WAIT); i can reachMAX_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
Quoted 33 lines
Signed-off-by Roel Kluin <[email protected]>--- arch/arm/mach-omap2/clock.c | 2 +- arch/arm/mach-omap2/powerdomain.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)arch/arm/mach-omap2/clock.c +1
-1@@ -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",arch/arm/mach-omap2/powerdomain.c +1
-2@@ -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 ; --
Quoted 4 lines
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
- Paul