aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Hunter <jonathanh@nvidia.com>2016-02-11 11:25:59 +0000
committerAlex Shi <alex.shi@linaro.org>2016-04-01 13:29:40 +0800
commitd5d44f3a3d1b1bb5f00811ecfdd2f987cd71ea3b (patch)
treecc2d78fa2bb0b8fd54ca3537b4e3d05e0455e33e
parent493347c02389d5775b8f35e2426c50f5504136b5 (diff)
PM / OPP: Fix NULL pointer dereference crash when disabling OPPs
Commit 7d34d56ef334 (PM / OPP: Disable OPPs that aren't supported by the regulator) causes a crash to happen on Tegra124 Jetson TK1 when using the DFLL clock source for the CPU. The DFLL manages the voltage itself and so there is no regulator specified for the OPPs and so we get a crash when we try to dereference the regulator pointer. Fix this by checking to see if the regulator IS_ERR_OR_NULL before dereferencing it. Fixes: 7d34d56ef334 (PM / OPP: Disable OPPs that aren't supported by the regulator) Signed-off-by: Jon Hunter <jonathanh@nvidia.com> Reported-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> [ rjw: Changelog ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> (cherry picked from commit 78ecc56247f0ec2bc0cf6f2f2af69e98d99767bc) Signed-off-by: Alex Shi <alex.shi@linaro.org>
-rw-r--r--drivers/base/power/opp/core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/base/power/opp/core.c b/drivers/base/power/opp/core.c
index d520056ebc8c..88c4afee63af 100644
--- a/drivers/base/power/opp/core.c
+++ b/drivers/base/power/opp/core.c
@@ -966,7 +966,7 @@ static bool _opp_supported_by_regulators(struct dev_pm_opp *opp,
{
struct regulator *reg = dev_opp->regulator;
- if (!IS_ERR(reg) &&
+ if (!IS_ERR_OR_NULL(reg) &&
!regulator_is_supported_voltage(reg, opp->u_volt_min,
opp->u_volt_max)) {
pr_warn("%s: OPP minuV: %lu maxuV: %lu, not supported by regulator\n",