Skip to contentSkip to conversation

clk: Warn about critical clks that fail to enable

PATCH Applied Stephen Boyd 3 participants 4 messages Jan 2, 2020 – Jan 5, 2020 Common clk

lore
Share & tools
lore

Stephen Boyd

author maintainer
#0 lore raw

PATCH v2 1/1 clk: Warn about critical clks that fail to enable

If we don't warn here users of the CLK_IS_CRITICAL flag may not know that their clk isn't actually enabled because it silently fails to enable. Let's print a warning in that case so developers find these problems faster.

---

Changes from v1:
* Switched to pr_warn and indicated clk name

 drivers/clk/clk.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/clk/clk.c +6 -1
index 772258de2d1f..b03c2be4014b 100644
@@ -3427,13 +3427,18 @@ static int __clk_core_init(struct clk_core *core)
 		unsigned long flags;
 
 		ret = clk_core_prepare(core);
-		if (ret)
+		if (ret) {
+			pr_warn("%s: critical clk '%s' failed to prepare\n",
+			       __func__, core->name);
 			goto out;
+		}
 
 		flags = clk_enable_lock();
 		ret = clk_core_enable(core);
 		clk_enable_unlock(flags);
 		if (ret) {
+			pr_warn("%s: critical clk '%s' failed to enable\n",
+			       __func__, core->name);
 			clk_core_unprepare(core);
 			goto out;
 		}

base-commit: 12ead77432f2ce32dea797742316d15c5800cb32

Signature · 1 line
Sent by a computer, using git, on the internet
Reviewed-by on v2 1/1
#1 lore raw
Quoted 4 lines · Stephen Boyd

If we don't warn here users of the CLK_IS_CRITICAL flag may not know that their clk isn't actually enabled because it silently fails to enable. Let's print a warning in that case so developers find these problems faster.

Thanks Stephen !

Quoted 38 lines

---

Changes from v1:
* Switched to pr_warn and indicated clk name

 drivers/clk/clk.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/clk/clk.c +6 -1
index 772258de2d1f..b03c2be4014b 100644
@@ -3427,13 +3427,18 @@ static int __clk_core_init(struct clk_core *core)
 		unsigned long flags;
 
 		ret = clk_core_prepare(core);
-		if (ret)
+		if (ret) {
+			pr_warn("%s: critical clk '%s' failed to prepare\n",
+			       __func__, core->name);
 			goto out;
+		}
 
 		flags = clk_enable_lock();
 		ret = clk_core_enable(core);
 		clk_enable_unlock(flags);
 		if (ret) {
+			pr_warn("%s: critical clk '%s' failed to enable\n",
+			       __func__, core->name);
 			clk_core_unprepare(core);
 			goto out;
 		}

base-commit: 12ead77432f2ce32dea797742316d15c5800cb32

Reviewed-by on v2 1/1
#2 lore raw
In reply to Stephen Boyd
Quoted 8 lines · Stephen Boyd

If we don't warn here users of the CLK_IS_CRITICAL flag may not know that their clk isn't actually enabled because it silently fails to enable. Let's print a warning in that case so developers find these problems faster.

Quoted 35 lines

---

Changes from v1:
* Switched to pr_warn and indicated clk name

  drivers/clk/clk.c | 7 ++++++-
  1 file changed, 6 insertions(+), 1 deletion(-)
drivers/clk/clk.c +6 -1
index 772258de2d1f..b03c2be4014b 100644
@@ -3427,13 +3427,18 @@ static int __clk_core_init(struct clk_core *core)
  		unsigned long flags;
 
  		ret = clk_core_prepare(core);
-		if (ret)
+		if (ret) {
+			pr_warn("%s: critical clk '%s' failed to prepare\n",
+			       __func__, core->name);
  			goto out;
+		}
 
  		flags = clk_enable_lock();
  		ret = clk_core_enable(core);
  		clk_enable_unlock(flags);
  		if (ret) {
+			pr_warn("%s: critical clk '%s' failed to enable\n",
+			       __func__, core->name);
  			clk_core_unprepare(core);
  			goto out;
  		}

base-commit: 12ead77432f2ce32dea797742316d15c5800cb32

author maintainer Applied
#3 lore raw
In reply to Stephen Boyd

Quoting Stephen Boyd (2020-01-01 16:55:03)

Quoted 9 lines

If we don't warn here users of the CLK_IS_CRITICAL flag may not know that their clk isn't actually enabled because it silently fails to enable. Let's print a warning in that case so developers find these problems faster.

---

Applied to clk-next