diff mbox

PM / OPP: Fix NULL pointer dereference when no regulator is defined

Message ID 6387373.HWURUPOrgK@amdc1976 (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Bartlomiej Zolnierkiewicz Feb. 11, 2016, 4:13 p.m. UTC
Commit 7d34d56ef334 ("PM / OPP: Disable OPPs that aren't
supported by the regulator") causes NULL pointer dereference
OOPS when no regulator for OPP is defined.  Fix it by
replacing IS_ERR() check with IS_ERR_OR_NULL() one (since
providing regulator for OPP is optional).

Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Fixes: 7d34d56ef334 ("PM / OPP: Disable OPPs that aren't supported by the regulator")
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
This fixes linux-pm/linux-next tree boot hang regression on
Exynos4412 SoC based Odroid-U3 board.

Rafael, please apply.  Thank you!

 drivers/base/power/opp/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Rafael J. Wysocki Feb. 11, 2016, 9:17 p.m. UTC | #1
On Thu, Feb 11, 2016 at 5:13 PM, Bartlomiej Zolnierkiewicz
<b.zolnierkie@samsung.com> wrote:
> Commit 7d34d56ef334 ("PM / OPP: Disable OPPs that aren't
> supported by the regulator") causes NULL pointer dereference
> OOPS when no regulator for OPP is defined.  Fix it by
> replacing IS_ERR() check with IS_ERR_OR_NULL() one (since
> providing regulator for OPP is optional).
>
> Cc: Viresh Kumar <viresh.kumar@linaro.org>
> Cc: Stephen Boyd <sboyd@codeaurora.org>
> Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Fixes: 7d34d56ef334 ("PM / OPP: Disable OPPs that aren't supported by the regulator")
> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
> ---
> This fixes linux-pm/linux-next tree boot hang regression on
> Exynos4412 SoC based Odroid-U3 board.
>
> Rafael, please apply.  Thank you!

This has been fixed by an identical patch from Jon Hunter I received earlier.

Thanks,
Rafael
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/base/power/opp/core.c b/drivers/base/power/opp/core.c
index ab711c2..d7cd4e2 100644
--- a/drivers/base/power/opp/core.c
+++ b/drivers/base/power/opp/core.c
@@ -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",