From: Viresh Kumar <viresh.kumar@linaro.org>
To: Jisheng Zhang <jszhang@marvell.com>
Cc: vireshk@kernel.org, nm@ti.com, sboyd@codeaurora.org,
rjw@rjwysocki.net, gregkh@linuxfoundation.org,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] PM / OPP: optimize dev_pm_opp_set_rate() a bit
Date: Fri, 22 Jul 2016 09:21:51 -0700 [thread overview]
Message-ID: <20160722162151.GT3122@ubuntu> (raw)
In-Reply-To: <1469191370-1285-1-git-send-email-jszhang@marvell.com>
On 22-07-16, 20:42, Jisheng Zhang wrote:
> static int _set_opp_voltage(struct device *dev, struct regulator *reg,
> unsigned long u_volt, unsigned long u_volt_min,
> unsigned long u_volt_max)
> @@ -586,9 +565,24 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq)
> return -EINVAL;
> }
>
> - clk = _get_opp_clk(dev);
> - if (IS_ERR(clk))
> + rcu_read_lock();
> +
> + opp_table = _find_opp_table(dev);
> + if (IS_ERR(opp_table)) {
> + dev_err(dev, "%s: device opp doesn't exist\n", __func__);
> + rcu_read_unlock();
> + return PTR_ERR(opp_table);
> + }
> +
> + clk = opp_table->clk;
> + if (IS_ERR(clk)) {
> + dev_err(dev, "%s: No clock available for the device\n",
> + __func__);
> + rcu_read_unlock();
> return PTR_ERR(clk);
> + }
> +
> + rcu_read_unlock();
It is not _safe_ to use opp_table pointer after the rcu_read_unlock()
here.
--
viresh
next prev parent reply other threads:[~2016-07-22 16:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-22 12:42 [PATCH] PM / OPP: optimize dev_pm_opp_set_rate() a bit Jisheng Zhang
2016-07-22 14:30 ` kbuild test robot
2016-07-25 5:19 ` Jisheng Zhang
2016-07-25 6:05 ` Jisheng Zhang
2016-07-22 16:21 ` Viresh Kumar [this message]
2016-07-25 5:12 ` Jisheng Zhang
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=20160722162151.GT3122@ubuntu \
--to=viresh.kumar@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=jszhang@marvell.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=nm@ti.com \
--cc=rjw@rjwysocki.net \
--cc=sboyd@codeaurora.org \
--cc=vireshk@kernel.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).