aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2009-01-31 06:00:17 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2009-02-08 12:50:46 -0500
commita7f8c599c570fc0e2396e8fdccaeeeaefc41dac8 (patch)
tree46ffedd691670056203468f5ebfc32d5bf2a6ad8 /arch/arm/mach-omap2
parentbe5f34b77355b9b1720a88390e51441ef578720b (diff)
[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.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index 666274a8b10d..222c2c0d4a64 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)
419 int ret = 0; 419 int ret = 0;
420 420
421 if (clk->usecount++ == 0) { 421 if (clk->usecount++ == 0) {
422 if (clk->parent) 422 if (clk->parent) {
423 ret = omap2_clk_enable(clk->parent); 423 ret = omap2_clk_enable(clk->parent);
424 424 if (ret)
425 if (ret != 0) { 425 goto err;
426 clk->usecount--;
427 return ret;
428 } 426 }
429 427
430 if (clk->clkdm) 428 if (clk->clkdm)
431 omap2_clkdm_clk_enable(clk->clkdm, clk); 429 omap2_clkdm_clk_enable(clk->clkdm, clk);
432 430
433 ret = _omap2_clk_enable(clk); 431 ret = _omap2_clk_enable(clk);
434 432 if (ret) {
435 if (ret != 0) {
436 if (clk->clkdm) 433 if (clk->clkdm)
437 omap2_clkdm_clk_disable(clk->clkdm, clk); 434 omap2_clkdm_clk_disable(clk->clkdm, clk);
438 435
439 if (clk->parent) { 436 if (clk->parent)
440 omap2_clk_disable(clk->parent); 437 omap2_clk_disable(clk->parent);
441 clk->usecount--; 438
442 } 439 goto err;
443 } 440 }
444 } 441 }
442 return ret;
445 443
444err:
445 clk->usecount--;
446 return ret; 446 return ret;
447} 447}
448 448