diff mbox series

[v2] clk: Warn about critical clks that fail to enable

Message ID 20200102005503.71923-1-sboyd@kernel.org (mailing list archive)
State Accepted, archived
Headers show
Series [v2] clk: Warn about critical clks that fail to enable | expand

Commit Message

Stephen Boyd Jan. 2, 2020, 12:55 a.m. UTC
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.

Suggested-by: Jerome Brunet <jbrunet@baylibre.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
---

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

 drivers/clk/clk.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)


base-commit: 12ead77432f2ce32dea797742316d15c5800cb32

Comments

Jerome Brunet Jan. 2, 2020, 12:47 p.m. UTC | #1
On Thu 02 Jan 2020 at 01:55, Stephen Boyd <sboyd@kernel.org> wrote:

> 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 !
Reviewed-by: Jerome Brunet <jbrunet@baylibre.com>

>
> Suggested-by: Jerome Brunet <jbrunet@baylibre.com>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
> ---
>
> Changes from v1:
>  * Switched to pr_warn and indicated clk name
>
>  drivers/clk/clk.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index 772258de2d1f..b03c2be4014b 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -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
Guenter Roeck Jan. 2, 2020, 2:17 p.m. UTC | #2
On 1/1/20 4:55 PM, Stephen Boyd wrote:
> 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.
> 
> Suggested-by: Jerome Brunet <jbrunet@baylibre.com>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Signed-off-by: Stephen Boyd <sboyd@kernel.org>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
> 
> Changes from v1:
>   * Switched to pr_warn and indicated clk name
> 
>   drivers/clk/clk.c | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index 772258de2d1f..b03c2be4014b 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -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
>
Stephen Boyd Jan. 5, 2020, 7:22 a.m. UTC | #3
Quoting Stephen Boyd (2020-01-01 16:55:03)
> 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.
> 
> Suggested-by: Jerome Brunet <jbrunet@baylibre.com>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
> ---

Applied to clk-next
diff mbox series

Patch

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 772258de2d1f..b03c2be4014b 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -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;
 		}