[ARM] omap: fix omap1 clock usecount decrement bug
authorRussell King <rmk@dyn-67.arm.linux.org.uk>
Sun, 5 Apr 2009 11:27:24 +0000 (12:27 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Mon, 6 Apr 2009 08:57:10 +0000 (09:57 +0100)
Same fix as per a7f8c59, but for OMAP1 instead.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mach-omap1/clock.c

index dafe4f71d15f2a4785f076d444a58e529480e176..336e51dc612725588b802ef9b0e4da53f3d70d63 100644 (file)
@@ -590,27 +590,28 @@ static void omap1_init_ext_clk(struct clk * clk)
 static int omap1_clk_enable(struct clk *clk)
 {
        int ret = 0;
+
        if (clk->usecount++ == 0) {
-               if (likely(clk->parent)) {
+               if (clk->parent) {
                        ret = omap1_clk_enable(clk->parent);
-
-                       if (unlikely(ret != 0)) {
-                               clk->usecount--;
-                               return ret;
-                       }
+                       if (ret)
+                               goto err;
 
                        if (clk->flags & CLOCK_NO_IDLE_PARENT)
                                omap1_clk_deny_idle(clk->parent);
                }
 
                ret = clk->ops->enable(clk);
-
-               if (unlikely(ret != 0) && clk->parent) {
-                       omap1_clk_disable(clk->parent);
-                       clk->usecount--;
+               if (ret) {
+                       if (clk->parent)
+                               omap1_clk_disable(clk->parent);
+                       goto err;
                }
        }
+       return ret;
 
+err:
+       clk->usecount--;
        return ret;
 }