All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] v2 pm: clk: fix a missing check of clk_prepare
@ 2019-01-05 19:58 Aditya Pakki
  2019-01-16 12:00 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Aditya Pakki @ 2019-01-05 19:58 UTC (permalink / raw)
  To: pakki001
  Cc: kjlu, Rafael J. Wysocki, Len Brown, Pavel Machek,
	Greg Kroah-Hartman, linux-pm, linux-kernel

clk_prepare() could fail, so let's check its status, and if it fails,
issue an error message and change the clock_entry_status to
PCE_STATUS_ERROR

Signed-off-by: Aditya Pakki <pakki001@umn.edu>
---
 drivers/base/power/clock_ops.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/base/power/clock_ops.c b/drivers/base/power/clock_ops.c
index 5a42ae4078c2..732764becafe 100644
--- a/drivers/base/power/clock_ops.c
+++ b/drivers/base/power/clock_ops.c
@@ -65,10 +65,15 @@ static void pm_clk_acquire(struct device *dev, struct pm_clock_entry *ce)
 	if (IS_ERR(ce->clk)) {
 		ce->status = PCE_STATUS_ERROR;
 	} else {
-		clk_prepare(ce->clk);
-		ce->status = PCE_STATUS_ACQUIRED;
-		dev_dbg(dev, "Clock %pC con_id %s managed by runtime PM.\n",
-			ce->clk, ce->con_id);
+		if (clk_prepare(ce->clk)) {
+			ce->status = PCE_STATUS_ERROR;
+			dev_err(dev, "clk_prepare failed\n");
+		} else {
+			ce->status = PCE_STATUS_ACQUIRED;
+			dev_dbg(dev,
+				"Clock %pC con_id %s managed by runtime PM.\n",
+				ce->clk, ce->con_id);
+		}
 	}
 }
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] v2 pm: clk: fix a missing check of clk_prepare
  2019-01-05 19:58 [PATCH] v2 pm: clk: fix a missing check of clk_prepare Aditya Pakki
@ 2019-01-16 12:00 ` Rafael J. Wysocki
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2019-01-16 12:00 UTC (permalink / raw)
  To: Aditya Pakki
  Cc: kjlu, Len Brown, Pavel Machek, Greg Kroah-Hartman, linux-pm,
	linux-kernel

On Saturday, January 5, 2019 8:58:45 PM CET Aditya Pakki wrote:
> clk_prepare() could fail, so let's check its status, and if it fails,
> issue an error message and change the clock_entry_status to
> PCE_STATUS_ERROR
> 
> Signed-off-by: Aditya Pakki <pakki001@umn.edu>
> ---
>  drivers/base/power/clock_ops.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/base/power/clock_ops.c b/drivers/base/power/clock_ops.c
> index 5a42ae4078c2..732764becafe 100644
> --- a/drivers/base/power/clock_ops.c
> +++ b/drivers/base/power/clock_ops.c
> @@ -65,10 +65,15 @@ static void pm_clk_acquire(struct device *dev, struct pm_clock_entry *ce)
>  	if (IS_ERR(ce->clk)) {
>  		ce->status = PCE_STATUS_ERROR;
>  	} else {
> -		clk_prepare(ce->clk);
> -		ce->status = PCE_STATUS_ACQUIRED;
> -		dev_dbg(dev, "Clock %pC con_id %s managed by runtime PM.\n",
> -			ce->clk, ce->con_id);
> +		if (clk_prepare(ce->clk)) {
> +			ce->status = PCE_STATUS_ERROR;
> +			dev_err(dev, "clk_prepare failed\n");
> +		} else {
> +			ce->status = PCE_STATUS_ACQUIRED;
> +			dev_dbg(dev,
> +				"Clock %pC con_id %s managed by runtime PM.\n",
> +				ce->clk, ce->con_id);
> +		}
>  	}
>  }
>  
> 

Applied (with some minor modifications), thanks!



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-01-16 12:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-05 19:58 [PATCH] v2 pm: clk: fix a missing check of clk_prepare Aditya Pakki
2019-01-16 12:00 ` Rafael J. Wysocki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.