Commit 8f0680af authored by Paul Walmsley's avatar Paul Walmsley Committed by Tony Lindgren

OMAP2/3 clock: omap2_clk_enable(): fix logic

Rearrange the parent clock enable status check code so it actually makes
sense.  No functional change.
Signed-off-by: default avatarPaul Walmsley <paul@pwsan.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 75fc235f
...@@ -483,20 +483,23 @@ void omap2_clk_disable(struct clk *clk) ...@@ -483,20 +483,23 @@ void omap2_clk_disable(struct clk *clk)
int omap2_clk_enable(struct clk *clk) int omap2_clk_enable(struct clk *clk)
{ {
int ret = 0; int ret;
if (++clk->usecount > 1) if (++clk->usecount > 1)
return 0; return 0;
omap2_clkdm_clk_enable(clk->clkdm.ptr, clk); omap2_clkdm_clk_enable(clk->clkdm.ptr, clk);
if (clk->parent) if (clk->parent) {
ret = omap2_clk_enable(clk->parent); int parent_ret;
if (ret != 0) { parent_ret = omap2_clk_enable(clk->parent);
if (parent_ret != 0) {
clk->usecount--; clk->usecount--;
omap2_clkdm_clk_disable(clk->clkdm.ptr, clk); omap2_clkdm_clk_disable(clk->clkdm.ptr, clk);
return ret; return parent_ret;
}
} }
ret = _omap2_clk_enable(clk); ret = _omap2_clk_enable(clk);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment