summaryrefslogtreecommitdiffstats
path: root/drivers/opp/cpu.c
diff options
context:
space:
mode:
authorViresh Kumar2018-08-03 03:35:21 +0200
committerViresh Kumar2018-09-19 23:56:40 +0200
commit3d2556992a878a2210d3be498416aee39e0c32aa (patch)
tree76f9566a83f216de277434d5613efdb059f2210d /drivers/opp/cpu.c
parentOPP: Don't try to remove all OPP tables on failure (diff)
downloadkernel-qcow2-linux-3d2556992a878a2210d3be498416aee39e0c32aa.tar.gz
kernel-qcow2-linux-3d2556992a878a2210d3be498416aee39e0c32aa.tar.xz
kernel-qcow2-linux-3d2556992a878a2210d3be498416aee39e0c32aa.zip
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.c2
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);
}