PM: clock_ops: fix missing clk_prepare() return value check
authorAditya Pakki <pakki001@umn.edu>
Sat, 5 Jan 2019 19:58:45 +0000 (13:58 -0600)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 18 Jan 2019 10:47:07 +0000 (11:47 +0100)
clk_prepare() can fail, so 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>
[ rjw: Subject ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/base/power/clock_ops.c

index 5a42ae4078c27febf8194901d8fa0e30b43bd1aa..365ad751ce0f34ae2cb447dc7c21acb2cc02740e 100644 (file)
@@ -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);
+               }
        }
 }