summaryrefslogtreecommitdiff
path: root/drivers/base/power
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2015-09-09 16:58:22 +0530
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-09-09 22:53:37 +0200
commit1b2b90cbea00670221f062814dc8bcecb3af7b90 (patch)
tree37edfaad03b3d748e0d951b697e519a91e5328c9 /drivers/base/power
parent4eafbd15b6c84cd3f6c76022c8a6c27f7cc076e1 (diff)
PM / OPP: Return suspend_opp only if it is enabled
There is no point returning suspend_opp, if it is disabled by the core. As we can't use it at all. Fix it. Fixes: 4eafbd15b6c8 ("PM / OPP: add dev_pm_opp_get_suspend_opp() helper") Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/base/power')
-rw-r--r--drivers/base/power/opp.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c
index 3df62dbcec3a..4eff4cd7eb54 100644
--- a/drivers/base/power/opp.c
+++ b/drivers/base/power/opp.c
@@ -345,7 +345,7 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_get_max_clock_latency);
* @dev: device for which we do this operation
*
* Return: This function returns pointer to the suspend opp if it is
- * defined, otherwise it returns NULL.
+ * defined and available, otherwise it returns NULL.
*
* Locking: This function must be called under rcu_read_lock(). opp is a rcu
* protected pointer. The reason for the same is that the opp pointer which is
@@ -356,17 +356,15 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_get_max_clock_latency);
struct dev_pm_opp *dev_pm_opp_get_suspend_opp(struct device *dev)
{
struct device_opp *dev_opp;
- struct dev_pm_opp *opp;
opp_rcu_lockdep_assert();
dev_opp = _find_device_opp(dev);
- if (IS_ERR(dev_opp))
- opp = NULL;
- else
- opp = dev_opp->suspend_opp;
+ if (IS_ERR(dev_opp) || !dev_opp->suspend_opp ||
+ !dev_opp->suspend_opp->available)
+ return NULL;
- return opp;
+ return dev_opp->suspend_opp;
}
EXPORT_SYMBOL_GPL(dev_pm_opp_get_suspend_opp);