提交 a7f8c599 编写于 作者: R Russell King 提交者: Russell King

[ARM] omap: fix usecount decrement bug

Based upon a patch from Paul Walmsley <paul@pwsan.com>:

 If _omap2_clk_enable() fails, the clock's usecount must be decremented
 by one no matter whether the clock has a parent or not.

but reorganised a bit.
Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
上级 be5f34b7
......@@ -419,30 +419,30 @@ int omap2_clk_enable(struct clk *clk)
int ret = 0;
if (clk->usecount++ == 0) {
if (clk->parent)
if (clk->parent) {
ret = omap2_clk_enable(clk->parent);
if (ret != 0) {
clk->usecount--;
return ret;
if (ret)
goto err;
}
if (clk->clkdm)
omap2_clkdm_clk_enable(clk->clkdm, clk);
ret = _omap2_clk_enable(clk);
if (ret != 0) {
if (ret) {
if (clk->clkdm)
omap2_clkdm_clk_disable(clk->clkdm, clk);
if (clk->parent) {
if (clk->parent)
omap2_clk_disable(clk->parent);
clk->usecount--;
}
goto err;
}
}
return ret;
err:
clk->usecount--;
return ret;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册