From f0b531594f0e7c133fc80ff050171d8ce5f8192a Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Mon, 24 Feb 2020 11:37:13 +0100 Subject: 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 --- drivers/clk/clk.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 05bc21a6d4..5777c9c58e 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); -- cgit v1.2.3