RE: [PATCH 02/12] PM / devfreq: Fix locking range for making the frequency table

From: MyungJoo Ham
Date: Sun Aug 27 2017 - 20:26:00 EST


> Even if the freq_table is included in the struct devfreq,
> the commit 0ec09ac2cebe ("PM / devfreq: Set the freq_table
> of devfreq device") set the frequency table outside the mutex locking.
>
> So, this patch initializes the frequency table within the mutex locking.
>
> Cc: stable@xxxxxxxxxxxxxxx
> Fixes: 0ec09ac2cebe ("PM / devfreq: Set the freq_table of devfreq device")
> Signed-off-by: Chanwoo Choi <cw00.choi@xxxxxxxxxxx>

Is this because you do not have locks inside
devfreq_set_freq_table() anymore?

> ---
> drivers/devfreq/devfreq.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
> index a1c4ee818614..3c5ccb96e165 100644
> --- a/drivers/devfreq/devfreq.c
> +++ b/drivers/devfreq/devfreq.c
> @@ -553,11 +553,8 @@ struct devfreq *devfreq_add_device(struct device *dev,
> devfreq->data = data;
> devfreq->nb.notifier_call = devfreq_notifier_call;
>
> - if (!devfreq->profile->max_state && !devfreq->profile->freq_table) {
> - mutex_unlock(&devfreq->lock);
> + if (!devfreq->profile->max_state && !devfreq->profile->freq_table)
> devfreq_set_freq_table(devfreq);
> - mutex_lock(&devfreq->lock);
> - }
>
> dev_set_name(&devfreq->dev, "devfreq%d",
> atomic_inc_return(&devfreq_no));