diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2018-08-03 07:05:21 +0530 |
---|---|---|
committer | Viresh Kumar <viresh.kumar@linaro.org> | 2018-09-19 14:56:40 -0700 |
commit | 3d2556992a878a2210d3be498416aee39e0c32aa (patch) | |
tree | 76f9566a83f216de277434d5613efdb059f2210d /drivers/opp/cpu.c | |
parent | 404b1369ea26f598b96ae4d3183262a879703cfe (diff) | |
download | linux-3d2556992a878a2210d3be498416aee39e0c32aa.tar.bz2 |
OPP: Protect dev_list with opp_table lock
The dev_list needs to be protected with a lock, else we may have
simultaneous access (addition/removal) to it and that would be racy.
Extend scope of the opp_table lock to protect dev_list as well.
Tested-by: Niklas Cassel <niklas.cassel@linaro.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Diffstat (limited to 'drivers/opp/cpu.c')
-rw-r--r-- | drivers/opp/cpu.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/opp/cpu.c b/drivers/opp/cpu.c index 2eb5e2e7ff66..36586f66cd83 100644 --- a/drivers/opp/cpu.c +++ b/drivers/opp/cpu.c @@ -226,8 +226,10 @@ int dev_pm_opp_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask) cpumask_clear(cpumask); if (opp_table->shared_opp == OPP_TABLE_ACCESS_SHARED) { + mutex_lock(&opp_table->lock); list_for_each_entry(opp_dev, &opp_table->dev_list, node) cpumask_set_cpu(opp_dev->dev->id, cpumask); + mutex_unlock(&opp_table->lock); } else { cpumask_set_cpu(cpu_dev->id, cpumask); } |