Skip to content

Commit ed34315

Browse files
jonhunterAlex Shi
authored andcommitted
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>
1 parent 6229dc0 commit ed34315

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/base/power/opp/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -975,7 +975,7 @@ static bool _opp_supported_by_regulators(struct dev_pm_opp *opp,
975975
{
976976
struct regulator *reg = dev_opp->regulator;
977977

978-
if (!IS_ERR(reg) &&
978+
if (!IS_ERR_OR_NULL(reg) &&
979979
!regulator_is_supported_voltage(reg, opp->u_volt_min,
980980
opp->u_volt_max)) {
981981
pr_warn("%s: OPP minuV: %lu maxuV: %lu, not supported by regulator\n",

0 commit comments

Comments
 (0)