Browse Source

bus: arm-ccn: Handle correctly no-more-cpus case

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 <dan.carpenter@oracle.com>
Signed-off-by: Pawel Moll <pawel.moll@arm.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Pawel Moll 10 years ago
parent
commit
b20519fd50
1 changed files with 1 additions and 1 deletions
  1. 1 1
      drivers/bus/arm-ccn.c

+ 1 - 1
drivers/bus/arm-ccn.c

@@ -1184,7 +1184,7 @@ static int arm_ccn_pmu_cpu_notifier(struct notifier_block *nb,
 		if (!cpumask_test_and_clear_cpu(cpu, &dt->cpu))
 		if (!cpumask_test_and_clear_cpu(cpu, &dt->cpu))
 			break;
 			break;
 		target = cpumask_any_but(cpu_online_mask, cpu);
 		target = cpumask_any_but(cpu_online_mask, cpu);
-		if (target < 0)
+		if (target >= nr_cpu_ids)
 			break;
 			break;
 		perf_pmu_migrate_context(&dt->pmu, cpu, target);
 		perf_pmu_migrate_context(&dt->pmu, cpu, target);
 		cpumask_set_cpu(target, &dt->cpu);
 		cpumask_set_cpu(target, &dt->cpu);