aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/omap-smp.c
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2010-12-03 05:42:58 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-12-20 10:08:26 -0500
commitbbc3d14e9aca023bb98e580aa1c9350af8effdb1 (patch)
treed4b70bc67c04d1cbe05948a9368f916198237dbc /arch/arm/mach-omap2/omap-smp.c
parent28e18293cf0f8d23a0950d7b1d2212d11af494dc (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-omap2/omap-smp.c')
-rw-r--r--arch/arm/mach-omap2/omap-smp.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c
index 56a8bce247c8..3c87468ce9cb 100644
--- a/arch/arm/mach-omap2/omap-smp.c
+++ b/arch/arm/mach-omap2/omap-smp.c
@@ -120,16 +120,6 @@ void __init smp_init_cpus(void)
120 120
121 ncores = get_core_count(); 121 ncores = get_core_count();
122 122
123 for (i = 0; i < ncores; i++)
124 set_cpu_possible(i, true);
125}
126
127void __init smp_prepare_cpus(unsigned int max_cpus)
128{
129 unsigned int ncores = get_core_count();
130 unsigned int cpu = smp_processor_id();
131 int i;
132
133 /* sanity check */ 123 /* sanity check */
134 if (ncores == 0) { 124 if (ncores == 0) {
135 printk(KERN_ERR 125 printk(KERN_ERR
@@ -144,6 +134,17 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
144 ncores, NR_CPUS); 134 ncores, NR_CPUS);
145 ncores = NR_CPUS; 135 ncores = NR_CPUS;
146 } 136 }
137
138 for (i = 0; i < ncores; i++)
139 set_cpu_possible(i, true);
140}
141
142void __init smp_prepare_cpus(unsigned int max_cpus)
143{
144 unsigned int ncores = num_possible_cpus();
145 unsigned int cpu = smp_processor_id();
146 int i;
147
147 smp_store_cpu_info(cpu); 148 smp_store_cpu_info(cpu);
148 149
149 /* 150 /*