aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Pitre <nicolas.pitre@linaro.org>2015-03-14 20:29:44 -0400
committerOlof Johansson <olof@lixom.net>2015-04-03 15:52:47 -0400
commit03fd5db717918b36a4ac1dbfc197222041608eab (patch)
treea8c41082f97f5b447b5de7d8afa3b5c9c6abcf1c
parent41f26e2d94374f7a31d3dc0b03223df7006a83cd (diff)
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>
-rw-r--r--arch/arm/mach-vexpress/dcscb.c6
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)
54 unsigned int all_mask; 54 unsigned int all_mask;
55 55
56 pr_debug("%s: cpu %u cluster %u\n", __func__, cpu, cluster); 56 pr_debug("%s: cpu %u cluster %u\n", __func__, cpu, cluster);
57 if (cpu >= 4 || cluster >= 2) 57 if (cluster >= 2 || !(cpumask & dcscb_allcpus_mask[cluster]))
58 return -EINVAL; 58 return -EINVAL;
59 59
60 all_mask = dcscb_allcpus_mask[cluster]; 60 all_mask = dcscb_allcpus_mask[cluster];
@@ -105,7 +105,7 @@ static void dcscb_power_down(void)
105 cpumask = (1 << cpu); 105 cpumask = (1 << cpu);
106 106
107 pr_debug("%s: cpu %u cluster %u\n", __func__, cpu, cluster); 107 pr_debug("%s: cpu %u cluster %u\n", __func__, cpu, cluster);
108 BUG_ON(cpu >= 4 || cluster >= 2); 108 BUG_ON(cluster >= 2 || !(cpumask & dcscb_allcpus_mask[cluster]));
109 109
110 all_mask = dcscb_allcpus_mask[cluster]; 110 all_mask = dcscb_allcpus_mask[cluster];
111 111
@@ -189,7 +189,7 @@ static void __init dcscb_usage_count_init(void)
189 cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1); 189 cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1);
190 190
191 pr_debug("%s: cpu %u cluster %u\n", __func__, cpu, cluster); 191 pr_debug("%s: cpu %u cluster %u\n", __func__, cpu, cluster);
192 BUG_ON(cpu >= 4 || cluster >= 2); 192 BUG_ON(cluster >= 2 || !((1 << cpu) & dcscb_allcpus_mask[cluster]));
193 dcscb_use_count[cpu][cluster] = 1; 193 dcscb_use_count[cpu][cluster] = 1;
194} 194}
195 195