diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2009-01-31 11:00:17 +0000 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-02-08 17:50:46 +0000 |
commit | a7f8c599c570fc0e2396e8fdccaeeeaefc41dac8 (patch) | |
tree | 46ffedd691670056203468f5ebfc32d5bf2a6ad8 /arch/arm/mach-omap2 | |
parent | be5f34b77355b9b1720a88390e51441ef578720b (diff) | |
download | linux-3.10-a7f8c599c570fc0e2396e8fdccaeeeaefc41dac8.tar.gz linux-3.10-a7f8c599c570fc0e2396e8fdccaeeeaefc41dac8.tar.bz2 linux-3.10-a7f8c599c570fc0e2396e8fdccaeeeaefc41dac8.zip |
[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: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-omap2')
-rw-r--r-- | arch/arm/mach-omap2/clock.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c index 666274a8b10..222c2c0d4a6 100644 --- a/arch/arm/mach-omap2/clock.c +++ b/arch/arm/mach-omap2/clock.c @@ -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; } |