Commit 0f17380c authored by Andrzej Hajda's avatar Andrzej Hajda Committed by Will Deacon

arm-cci: fix handling cpumask_any_but return value

cpumask_any_but returns value >= nr_cpu_ids if there are no more CPUs.

The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2038576Acked-by: default avatarOlof Johansson <olof@lixom.net>
Signed-off-by: default avatarAndrzej Hajda <a.hajda@samsung.com>
Acked-by: default avatarWill Deacon <will.deacon@arm.com>
Signed-off-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
parent 5e442eba
...@@ -1270,7 +1270,7 @@ static int cci_pmu_cpu_notifier(struct notifier_block *self, ...@@ -1270,7 +1270,7 @@ static int cci_pmu_cpu_notifier(struct notifier_block *self,
if (!cpumask_test_and_clear_cpu(cpu, &cci_pmu->cpus)) if (!cpumask_test_and_clear_cpu(cpu, &cci_pmu->cpus))
break; break;
target = cpumask_any_but(cpu_online_mask, cpu); target = cpumask_any_but(cpu_online_mask, cpu);
if (target < 0) // UP, last CPU if (target >= nr_cpu_ids) // UP, last CPU
break; break;
/* /*
* TODO: migrate context once core races on event->ctx have * TODO: migrate context once core races on event->ctx have
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment