diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-12-03 05:42:58 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-12-20 10:08:26 -0500 |
commit | bbc3d14e9aca023bb98e580aa1c9350af8effdb1 (patch) | |
tree | d4b70bc67c04d1cbe05948a9368f916198237dbc /arch/arm/mach-ux500/platsmp.c | |
parent | 28e18293cf0f8d23a0950d7b1d2212d11af494dc (diff) |
ARM: SMP: move CPU number sanity checks to smp_init_cpus()
Ensure that the number of CPUs is sanity checked before setting
the number of possible CPUs. This avoids any chance of overflowing
the cpu_possible bitmap.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-ux500/platsmp.c')
-rw-r--r-- | arch/arm/mach-ux500/platsmp.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/arch/arm/mach-ux500/platsmp.c b/arch/arm/mach-ux500/platsmp.c index b8987bd21249..a51962b7579b 100644 --- a/arch/arm/mach-ux500/platsmp.c +++ b/arch/arm/mach-ux500/platsmp.c | |||
@@ -128,16 +128,6 @@ void __init smp_init_cpus(void) | |||
128 | { | 128 | { |
129 | unsigned int i, ncores = get_core_count(); | 129 | unsigned int i, ncores = get_core_count(); |
130 | 130 | ||
131 | for (i = 0; i < ncores; i++) | ||
132 | set_cpu_possible(i, true); | ||
133 | } | ||
134 | |||
135 | void __init smp_prepare_cpus(unsigned int max_cpus) | ||
136 | { | ||
137 | unsigned int ncores = get_core_count(); | ||
138 | unsigned int cpu = smp_processor_id(); | ||
139 | int i; | ||
140 | |||
141 | /* sanity check */ | 131 | /* sanity check */ |
142 | if (ncores == 0) { | 132 | if (ncores == 0) { |
143 | printk(KERN_ERR | 133 | printk(KERN_ERR |
@@ -145,14 +135,24 @@ void __init smp_prepare_cpus(unsigned int max_cpus) | |||
145 | ncores = 1; | 135 | ncores = 1; |
146 | } | 136 | } |
147 | 137 | ||
148 | if (ncores > num_possible_cpus()) { | 138 | if (ncores > NR_CPUS) { |
149 | printk(KERN_WARNING | 139 | printk(KERN_WARNING |
150 | "U8500: no. of cores (%d) greater than configured " | 140 | "U8500: no. of cores (%d) greater than configured " |
151 | "maximum of %d - clipping\n", | 141 | "maximum of %d - clipping\n", |
152 | ncores, num_possible_cpus()); | 142 | ncores, NR_CPUS); |
153 | ncores = num_possible_cpus(); | 143 | ncores = NR_CPUS; |
154 | } | 144 | } |
155 | 145 | ||
146 | for (i = 0; i < ncores; i++) | ||
147 | set_cpu_possible(i, true); | ||
148 | } | ||
149 | |||
150 | void __init smp_prepare_cpus(unsigned int max_cpus) | ||
151 | { | ||
152 | unsigned int ncores = num_possible_cpus(); | ||
153 | unsigned int cpu = smp_processor_id(); | ||
154 | int i; | ||
155 | |||
156 | smp_store_cpu_info(cpu); | 156 | smp_store_cpu_info(cpu); |
157 | 157 | ||
158 | /* | 158 | /* |