linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dtor@chromium.org>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Viresh Kumar <viresh.kumar@linaro.org>,
	Shawn Guo <shawn.guo@freescale.com>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Anson Huang <b20788@freescale.com>,
	John Tobias <john.tobias.ph@gmail.com>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] cpufreq: imx6: prorect calls to dev_pm_opp_get_opp_count with RCU lock
Date: Mon, 15 Dec 2014 16:50:48 -0800	[thread overview]
Message-ID: <20141216005048.GA3802@dtor-ws> (raw)

dev_pm_opp_get_opp_count() must be called with RCU lock held.

Signed-off-by: Dmitry Torokhov <dtor@chromium.org>
---

Not tested at all...

 drivers/cpufreq/imx6q-cpufreq.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c
index 380a90d..851d4fd 100644
--- a/drivers/cpufreq/imx6q-cpufreq.c
+++ b/drivers/cpufreq/imx6q-cpufreq.c
@@ -200,7 +200,9 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev)
 	 * Just, incase the platform did not supply the OPP
 	 * table, it will try to get it.
 	 */
+	rcu_read_lock();
 	num = dev_pm_opp_get_opp_count(cpu_dev);
+	rcu_read_unlock();
 	if (num < 0) {
 		ret = of_init_opp_table(cpu_dev);
 		if (ret < 0) {
@@ -211,7 +213,9 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev)
 		/* Because we have added the OPPs here, we must free them */
 		free_opp = true;
 
+		rcu_read_lock();
 		num = dev_pm_opp_get_opp_count(cpu_dev);
+		rcu_read_unlock();
 		if (num < 0) {
 			ret = num;
 			dev_err(cpu_dev, "no OPP table is found: %d\n", ret);
-- 
2.2.0.rc0.207.ga3a616c


-- 
Dmitry

             reply	other threads:[~2014-12-16  0:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-16  0:50 Dmitry Torokhov [this message]
2014-12-16  5:33 ` [PATCH] cpufreq: imx6: prorect calls to dev_pm_opp_get_opp_count with RCU lock Viresh Kumar
2014-12-16  5:41   ` Dmitry Torokhov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141216005048.GA3802@dtor-ws \
    --to=dtor@chromium.org \
    --cc=b20788@freescale.com \
    --cc=john.tobias.ph@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=rjw@rjwysocki.net \
    --cc=shawn.guo@freescale.com \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).