From patchwork Mon Feb 15 04:51:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 61921 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp856024lbl; Sun, 14 Feb 2016 20:52:09 -0800 (PST) X-Received: by 10.98.73.6 with SMTP id w6mr20993879pfa.82.1455511928878; Sun, 14 Feb 2016 20:52:08 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 2si40682610pfm.127.2016.02.14.20.52.08; Sun, 14 Feb 2016 20:52:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751800AbcBOEwH (ORCPT + 11 others); Sun, 14 Feb 2016 23:52:07 -0500 Received: from mail-pa0-f44.google.com ([209.85.220.44]:34400 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751758AbcBOEwG (ORCPT ); Sun, 14 Feb 2016 23:52:06 -0500 Received: by mail-pa0-f44.google.com with SMTP id fy10so39940233pac.1 for ; Sun, 14 Feb 2016 20:52:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=/LmvyLv3HWjz5UFAwkaboB2D+trbFYHtZcj7jqspxt0=; b=iErkZ2IWfw4IyRuGv0Y0o3GFG2oXmaJ18Xml49JeUsccSXlHkfi+I7QOTW3UhpBTX7 3XJADdYJfUmw8bnTT+CWkiumjq/pu4Gp0i8Qfg1nP5H6ShpOJ51MCDHYZYALxI84mvQl RJSCW+sdwEOnFW6zRHDqmblg2X2q/n+AmX2kI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=/LmvyLv3HWjz5UFAwkaboB2D+trbFYHtZcj7jqspxt0=; b=T75VmZ9TFwgvSQqiK2AwUXXnXRbkuMx3GZvv8iovUnTy5hko2vf0XpdwVntfcGqmBE BozhzXjW0EXwmFy3PB4Cp6R13G8D+YBs6Il0rgwMnc8YtoPL3S7rpl//lgm9DQVCR86R pQ0/a6/s2yoJepAghevK0SKZxB/vQ1oVqBTIiruALFNFmOqriUwjao8dj0rdK2A4fBoh 4YLitYRqiUHDShMZGq3jBHSM/SRjyvwOhwjNBHwi8fng98Je8k6xTR7c0Ecwti7JeGYW 2lOLQjXhJ3RS20lpmPfuddPOvbawnfSeBtHaGj7XPhbArd83/m5DoKp6yXwTHUu9XVQ/ X/4Q== X-Gm-Message-State: AG10YOT+6Zr3mh4DGwI2XqEnyyAu/lxU7bWNLxEJYPnSjSlOjJJoHTXj9zcp3nGw4ULXeqO3 X-Received: by 10.66.144.134 with SMTP id sm6mr15662156pab.158.1455511924972; Sun, 14 Feb 2016 20:52:04 -0800 (PST) Received: from localhost ([122.172.89.184]) by smtp.gmail.com with ESMTPSA id p9sm34799584pfa.11.2016.02.14.20.52.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 14 Feb 2016 20:52:04 -0800 (PST) From: Viresh Kumar To: Rafael Wysocki Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, Viresh Kumar , Krzysztof Kozlowski , Greg Kroah-Hartman , Len Brown , linux-kernel@vger.kernel.org (open list), Nishanth Menon , Pavel Machek , Stephen Boyd , Viresh Kumar Subject: [PATCH] PM / OPP: Initialize u_volt_min/max to a valid value Date: Mon, 15 Feb 2016 10:21:53 +0530 Message-Id: <13b96a7623af4969747e1c2f9f7994e7affb00d4.1455511404.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.7.1.397.g2a43f26 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org We kept u_volt_min/max initialized to 0, when only the target voltage is present in DT, instead of the target/min/max triplet. This didn't go well with the regulator framework, as on few calls the min voltage was set to target and max was set to 0 and so resulted in a kernel crash like below: kernel BUG at ../drivers/regulator/core.c:216! [] (regulator_check_voltage) from [] (regulator_set_voltage_unlocked+0x58/0x230) [] (regulator_set_voltage_unlocked) from [] (regulator_set_voltage+0x28/0x54) [] (regulator_set_voltage) from [] (_set_opp_voltage+0x30/0x98) [] (_set_opp_voltage) from [] (dev_pm_opp_set_rate+0xf0/0x28c) [] (dev_pm_opp_set_rate) from [] (__cpufreq_driver_target+0x184/0x2b4) [] (__cpufreq_driver_target) from [] (dbs_check_cpu+0x1b0/0x1f4) [] (dbs_check_cpu) from [] (cpufreq_governor_dbs+0x324/0x5c4) [] (cpufreq_governor_dbs) from [] (__cpufreq_governor+0xe4/0x1ec) [] (__cpufreq_governor) from [] (cpufreq_init_policy+0x64/0x8c) [] (cpufreq_init_policy) from [] (cpufreq_online+0x2fc/0x708) [] (cpufreq_online) from [] (subsys_interface_register+0x94/0xd8) [] (subsys_interface_register) from [] (cpufreq_register_driver+0x14c/0x19c) [] (cpufreq_register_driver) from [] (dt_cpufreq_probe+0x70/0xec) [] (dt_cpufreq_probe) from [] (platform_drv_probe+0x4c/0xb0) [] (platform_drv_probe) from [] (driver_probe_device+0x214/0x2c0) [] (driver_probe_device) from [] (__driver_attach+0x8c/0x90) [] (__driver_attach) from [] (bus_for_each_dev+0x68/0x9c) [] (bus_for_each_dev) from [] (bus_add_driver+0x1a0/0x218) [] (bus_add_driver) from [] (driver_register+0x78/0xf8) [] (driver_register) from [] (do_one_initcall+0x90/0x1d8) [] (do_one_initcall) from [] (kernel_init_freeable+0x15c/0x1fc) [] (kernel_init_freeable) from [] (kernel_init+0x8/0xf0) [] (kernel_init) from [] (ret_from_fork+0x14/0x3c) Code: e1550004 baffffeb e3a00000 e8bd8070 (e7f001f2) Fix that by initializing u_volt_min/max to the target voltage in such cases. Reported-and-tested-by: Krzysztof Kozlowski Fixes: 274659029c9d ("PM / OPP: Add support to parse "operating-points-v2" bindings") Signed-off-by: Viresh Kumar --- Rafael, This fixes a patch which was introduced in 4.2, but that wasn't used until recently and is only used in linux-next as of now. So, no need of a stable kernel tag. drivers/base/power/opp/core.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) -- 2.7.1.397.g2a43f26 -- 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 --git a/drivers/base/power/opp/core.c b/drivers/base/power/opp/core.c index d7cd4e265766..19fd7e7a3969 100644 --- a/drivers/base/power/opp/core.c +++ b/drivers/base/power/opp/core.c @@ -1157,8 +1157,14 @@ static int opp_parse_supplies(struct dev_pm_opp *opp, struct device *dev, } opp->u_volt = microvolt[0]; - opp->u_volt_min = microvolt[1]; - opp->u_volt_max = microvolt[2]; + + if (count == 1) { + opp->u_volt_min = opp->u_volt; + opp->u_volt_max = opp->u_volt; + } else { + opp->u_volt_min = microvolt[1]; + opp->u_volt_max = microvolt[2]; + } /* Search for "opp-microamp-" */ prop = NULL;