From: "MyungJoo Ham" <myungjoo.ham@samsung.com>
To: "Axel Lin" <axel.lin@ingics.com>,
"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>
Cc: "Chanwoo Choi" <cw00.choi@samsung.com>,
"Kyungmin Park" <kyungmin.park@samsung.com>,
"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
"linux-samsung-soc@vger.kernel.org"
<linux-samsung-soc@vger.kernel.org>
Subject: RE: [PATCH] PM / devfreq: Add proper locking around list_del()
Date: Thu, 29 Sep 2016 02:02:02 +0000 [thread overview]
Message-ID: <606654848.526330.1475114522281.JavaMail.weblogic@ep2ml104d> (raw)
In-Reply-To: CGME20160928091837epcas1p2e3a1fbf609e57b789c503ce4c1799dd1@epcas1p2.samsung.com
[-- Attachment #1: Type: text/plain, Size: 1199 bytes --]
> Use devfreq_list_lock around list_del() to prevent list corruption.
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
> drivers/devfreq/devfreq.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
> index 478006b..70369b0 100644
> --- a/drivers/devfreq/devfreq.c
> +++ b/drivers/devfreq/devfreq.c
> @@ -604,7 +604,10 @@ struct devfreq *devfreq_add_device(struct device *dev,
> return devfreq;
>
> err_init:
> + mutex_lock(&devfreq_list_lock);
> list_del(&devfreq->node);
> + mutex_unlock(&devfreq_list_lock);
> +
> device_unregister(&devfreq->dev);
> err_out:
> return ERR_PTR(err);
I'd rather modify:
- mutex_unlock(&devfreq_list_lock);
if (err) {
dev_err(dev, "%s: Unable to start governor for the device\n",
__func__);
goto err_init;
}
+ mutex_unlock(&devfreq_list_lock);
return devfreq;
err_init:
list_del(&devfreq->node);
device_unregister(&devfreq->dev);
+ mutex_unlock(&devfreq_list_lock);
How do you think?
Cheers,
MyungJoo
next parent reply other threads:[~2016-09-29 2:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20160928091837epcas1p2e3a1fbf609e57b789c503ce4c1799dd1@epcas1p2.samsung.com>
2016-09-29 2:02 ` MyungJoo Ham [this message]
2016-09-28 9:17 [PATCH] PM / devfreq: Add proper locking around list_del() Axel Lin
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=606654848.526330.1475114522281.JavaMail.weblogic@ep2ml104d \
--to=myungjoo.ham@samsung.com \
--cc=axel.lin@ingics.com \
--cc=cw00.choi@samsung.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-pm@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=rafael.j.wysocki@intel.com \
/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).