]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
PM / OPP: Fix NULL pointer dereference crash when disabling OPPs
authorJon Hunter <jonathanh@nvidia.com>
Thu, 11 Feb 2016 11:25:59 +0000 (11:25 +0000)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 11 Feb 2016 21:05:38 +0000 (22:05 +0100)
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>
drivers/base/power/opp/core.c

index ab711c2c3e0031ec3324e56942b32ed0129dd337..d7cd4e2657661bd32e8a673e44b3994b519ebb66 100644 (file)
@@ -975,7 +975,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",