OMAP2 clock/powerdomain: off by 1 error in loop timeout comparisons
authorRoel Kluin <roel.kluin@gmail.com>
Sat, 20 Jun 2009 01:08:30 +0000 (19:08 -0600)
committerpaul <paul@twilight.(none)>
Sat, 20 Jun 2009 01:09:32 +0000 (19:09 -0600)
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>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
arch/arm/mach-omap2/clock.c
arch/arm/mach-omap2/powerdomain.c

index ba528f85749c68d63cd3b360699130c340865e6e..b0665f161c03845725a019f1f62ea64be8cf154d 100644 (file)
@@ -302,7 +302,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",
index 73e2971b17573250e7ba4caaf7f7691b51c66266..983f1cb676be26ad24f88c7d834035a2c5fea15c 100644 (file)
@@ -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;