Skip to content

Commit

Permalink
bus: arm-ccn: Handle correctly no-more-cpus case
Browse files Browse the repository at this point in the history
When migrating events the driver picks another cpu using
cpumask_any_but() function, which returns value >= nr_cpu_ids
when there is none available, not a negative value as the code
assumed. Fixed now.

Reported-by: Dan Carpenter <[email protected]>
Signed-off-by: Pawel Moll <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
  • Loading branch information
pawelmoll authored and arndb committed Oct 15, 2015
1 parent f9e5ca8 commit b20519f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/bus/arm-ccn.c
Original file line number Diff line number Diff line change
Expand Up @@ -1184,7 +1184,7 @@ static int arm_ccn_pmu_cpu_notifier(struct notifier_block *nb,
if (!cpumask_test_and_clear_cpu(cpu, &dt->cpu))
break;
target = cpumask_any_but(cpu_online_mask, cpu);
if (target < 0)
if (target >= nr_cpu_ids)
break;
perf_pmu_migrate_context(&dt->pmu, cpu, target);
cpumask_set_cpu(target, &dt->cpu);
Expand Down

0 comments on commit b20519f

Please sign in to comment.