Commit 40619f7d authored by Aditya Pakki's avatar Aditya Pakki Committed by Rafael J. Wysocki
Browse files

PM: clock_ops: fix missing clk_prepare() return value check



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: default avatarAditya Pakki <pakki001@umn.edu>
[ rjw: Subject ]
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 3b4ed2e2
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -65,12 +65,17 @@ 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);
		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",
			dev_dbg(dev,
				"Clock %pC con_id %s managed by runtime PM.\n",
				ce->clk, ce->con_id);
		}
	}
}

static int __pm_clk_add(struct device *dev, const char *con_id,
			struct clk *clk)