summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2020-02-24 11:37:13 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2020-02-25 09:21:52 +0100
commitf0b531594f0e7c133fc80ff050171d8ce5f8192a (patch)
treeba156c37b6824baa55eb3575e04bae3718480368 /drivers
parentca18a9ebf0d6e8be8bebb93957de1d86917910a0 (diff)
downloadbarebox-f0b531594f0e7c133fc80ff050171d8ce5f8192a.tar.gz
clk: Do not let the enable count of critical clocks go below 1
The enable count of critical clocks may not drop below 1. Otherwise the new parent during a reparenting of a critical clock will not be enabled. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/clk/clk.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 05bc21a..5777c9c 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -84,12 +84,14 @@ void clk_disable(struct clk *clk)
if (!clk->enable_count)
return;
+ if (clk->enable_count == 1 && clk->flags & CLK_IS_CRITICAL) {
+ pr_warn("Disabling critical clock %s\n", clk->name);
+ return;
+ }
+
clk->enable_count--;
if (!clk->enable_count) {
- if (clk->flags & CLK_IS_CRITICAL)
- return;
-
if (clk->ops->disable)
clk->ops->disable(clk);