Hi Jane:

On Thu, Jan 02, 2014 at 11:14:42AM +0800, j...@marvell.com wrote:
> @@ -119,8 +121,11 @@ void gov_queue_work(struct dbs_data *dbs_data, struct 
> cpufreq_policy *policy,
>  {
>       int i;
>  
> -     if (!policy->governor_enabled)
> +     mutex_lock(&cpufreq_governor_lock);
> +     if (!policy->governor_enabled) {
> +             mutex_unlock(&cpufreq_governor_lock);
>               return;
> +     }
>  
>       if (!all_cpus) {
>               /*
> @@ -135,6 +140,7 @@ void gov_queue_work(struct dbs_data *dbs_data, struct 
> cpufreq_policy *policy,
>               for_each_cpu(i, policy->cpus)
>                       __gov_queue_work(i, dbs_data, delay);
>       }
> +     mutex_unlock(&cpufreq_governor_lock);

Unlocking in different branches is not the best practice IMO, I'd
recommend doing:

        mutex_lock(&cpufreq_governor_lock);

        if (!policy->governor_enabled)
                goto out_unlock;

        ...

out_unlock:
        mutex_unlock(&cpufreq_governor_lock);

Thanks!

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to