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

From: Dan Carpenter
Date: Fri Oct 30 2015 - 08:05:41 EST


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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/