Re: [PATCH] PM / OPP: Protect updates to list_dev with mutex

Dan Carpenter
2015-10-30T12:05:34Z

On Fri, Oct 30, 2015 at 05:26:06PM +0530, Viresh Kumar wrote:
> --- a/drivers/base/power/opp/cpu.c
> +++ b/drivers/base/power/opp/cpu.c
> @@ -124,12 +124,12 @@ int dev_pm_opp_set_sharing_cpus(struct device *cpu_dev, cpumask_var_t cpumask)
> struct device *dev;
> int cpu, ret = 0;
>
> - rcu_read_lock();
> + mutex_lock(&dev_opp_list_lock);
>
> dev_opp = _find_device_opp(cpu_dev);
> if (IS_ERR(dev_opp)) {
> ret = -EINVAL;
> - goto out_rcu_read_unlock;
> + goto unlock;
> }
>
> for_each_cpu(cpu, cpumask) {
> @@ -150,8 +150,8 @@ int dev_pm_opp_set_sharing_cpus(struct device *cpu_dev, cpumask_var_t cpumask)
> continue;
> }
> }
> -out_rcu_read_unlock:
> - rcu_read_unlock();
> +unlock:
> + mutex_unlock(&dev_opp_list_lock);
>
> return 0;

Not introduced by your patch, but this should be "return ret;"

regards,
dan carpenter