Messages in this thread | | | Subject | RE: [PATCH v3] PM / devfreq: Fix devfreq_add_device() when drivers are built as modules. | From | MyungJoo Ham <> | Date | Tue, 03 Jul 2018 19:57:23 +0900 |
| |
>@@ -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
| |