linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PM / OPP: Fix NULL pointer dereference when no regulator is defined
@ 2016-02-11 16:13 Bartlomiej Zolnierkiewicz
  2016-02-11 21:17 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2016-02-11 16:13 UTC (permalink / raw)
  To: Viresh Kumar, Rafael J. Wysocki
  Cc: linaro-kernel, linux-pm, Stephen Boyd, nm, Greg Kroah-Hartman,
	Len Brown, open list, Pavel Machek, Viresh Kumar, Rafael Wysocki,
	Bartlomiej Zolnierkiewicz

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(-)

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",
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-02-11 21:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-11 16:13 [PATCH] PM / OPP: Fix NULL pointer dereference when no regulator is defined Bartlomiej Zolnierkiewicz
2016-02-11 21:17 ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).