diff options
author | Nicolas Pitre <nicolas.pitre@linaro.org> | 2015-03-15 01:29:44 +0100 |
---|---|---|
committer | Olof Johansson <olof@lixom.net> | 2015-04-03 21:52:47 +0200 |
commit | 03fd5db717918b36a4ac1dbfc197222041608eab (patch) | |
tree | a8c41082f97f5b447b5de7d8afa3b5c9c6abcf1c /arch/arm | |
parent | ARM: vexpress: migrate TC2 to the new MCPM backend abstraction (diff) | |
download | linux-03fd5db717918b36a4ac1dbfc197222041608eab.tar.xz linux-03fd5db717918b36a4ac1dbfc197222041608eab.zip |
ARM: vexpress: DCSCB: tighten CPU validity assertion
Currently the cpu argument validity check uses a hardcoded limit of 4.
The DCSCB configuration data provides the actual number of CPUs and
we already use it elsewhere. Let's improve the cpu argument validity
check by using that information instead.
Signed-off-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-vexpress/dcscb.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/arm/mach-vexpress/dcscb.c b/arch/arm/mach-vexpress/dcscb.c index 30b993399ed7..12c74734cd70 100644 --- a/arch/arm/mach-vexpress/dcscb.c +++ b/arch/arm/mach-vexpress/dcscb.c @@ -54,7 +54,7 @@ static int dcscb_power_up(unsigned int cpu, unsigned int cluster) unsigned int all_mask; pr_debug("%s: cpu %u cluster %u\n", __func__, cpu, cluster); - if (cpu >= 4 || cluster >= 2) + if (cluster >= 2 || !(cpumask & dcscb_allcpus_mask[cluster])) return -EINVAL; all_mask = dcscb_allcpus_mask[cluster]; @@ -105,7 +105,7 @@ static void dcscb_power_down(void) cpumask = (1 << cpu); pr_debug("%s: cpu %u cluster %u\n", __func__, cpu, cluster); - BUG_ON(cpu >= 4 || cluster >= 2); + BUG_ON(cluster >= 2 || !(cpumask & dcscb_allcpus_mask[cluster])); all_mask = dcscb_allcpus_mask[cluster]; @@ -189,7 +189,7 @@ static void __init dcscb_usage_count_init(void) cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1); pr_debug("%s: cpu %u cluster %u\n", __func__, cpu, cluster); - BUG_ON(cpu >= 4 || cluster >= 2); + BUG_ON(cluster >= 2 || !((1 << cpu) & dcscb_allcpus_mask[cluster])); dcscb_use_count[cpu][cluster] = 1; } |