lkml.org 
[lkml]   [2018]   [Jul]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRE: [PATCH v3] PM / devfreq: Fix devfreq_add_device() when drivers are built as modules.
From
Date
>@@ -988,12 +1030,13 @@ static ssize_t governor_store(struct device *dev, struct device_attribute *attr,
> if (ret != 1)
> return -EINVAL;
>
>- mutex_lock(&devfreq_list_lock);
>- governor = find_devfreq_governor(str_governor);
>+ governor = try_then_request_governor(str_governor);
> if (IS_ERR(governor)) {
>- ret = PTR_ERR(governor);
>- goto out;
>+ return PTR_ERR(governor);
> }
>+
>+ mutex_lock(&devfreq_list_lock);
>+
> if (df->governor == governor) {
> ret = 0;
> goto out;
>--

The possibility that the result of try_then_request_governor is
not kept protected until the line of
"if (df->governor == governor)" is itching.

Can you make it kept "locked" from the return of
find_devfreq_governor() (either in try_then... or in this function)
to the unlock of governor_store()?


Cheers,
MyungJoo

\
 
 \ /
  Last update: 2018-07-03 12:58    [W:0.160 / U:0.516 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site