Commit 8975b6c0 authored by Russell King's avatar Russell King

ARM: SMP: Clean up ncores sanity checks

scu_get_core_count() never returns zero cores, so we don't need to
check and correct if ncores is zero.

Tegra was missing the check against NR_CPUS, leading to a potential
bitfield overflow if this becomes the case.
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent bbc3d14e
...@@ -121,12 +121,6 @@ void __init smp_init_cpus(void) ...@@ -121,12 +121,6 @@ void __init smp_init_cpus(void)
ncores = get_core_count(); ncores = get_core_count();
/* sanity check */ /* sanity check */
if (ncores == 0) {
printk(KERN_ERR
"OMAP4: strange core count of 0? Default to 1\n");
ncores = 1;
}
if (ncores > NR_CPUS) { if (ncores > NR_CPUS) {
printk(KERN_WARNING printk(KERN_WARNING
"OMAP4: no. of cores (%d) greater than configured " "OMAP4: no. of cores (%d) greater than configured "
......
...@@ -161,13 +161,6 @@ void __init smp_init_cpus(void) ...@@ -161,13 +161,6 @@ void __init smp_init_cpus(void)
unsigned int i, ncores = get_core_count(); unsigned int i, ncores = get_core_count();
/* sanity check */ /* sanity check */
if (ncores == 0) {
printk(KERN_ERR
"Realview: strange CM count of 0? Default to 1\n");
ncores = 1;
}
if (ncores > NR_CPUS) { if (ncores > NR_CPUS) {
printk(KERN_WARNING printk(KERN_WARNING
"Realview: no. of cores (%d) greater than configured " "Realview: no. of cores (%d) greater than configured "
......
...@@ -130,13 +130,6 @@ void __init smp_init_cpus(void) ...@@ -130,13 +130,6 @@ void __init smp_init_cpus(void)
ncores = scu_base ? scu_get_core_count(scu_base) : 1; ncores = scu_base ? scu_get_core_count(scu_base) : 1;
/* sanity check */ /* sanity check */
if (ncores == 0) {
printk(KERN_ERR
"S5PV310: strange CM count of 0? Default to 1\n");
ncores = 1;
}
if (ncores > NR_CPUS) { if (ncores > NR_CPUS) {
printk(KERN_WARNING printk(KERN_WARNING
"S5PV310: no. of cores (%d) greater than configured " "S5PV310: no. of cores (%d) greater than configured "
......
...@@ -117,6 +117,12 @@ void __init smp_init_cpus(void) ...@@ -117,6 +117,12 @@ void __init smp_init_cpus(void)
{ {
unsigned int i, ncores = scu_get_core_count(scu_base); unsigned int i, ncores = scu_get_core_count(scu_base);
if (ncores > NR_CPUS) {
printk(KERN_ERR "Tegra: no. of cores (%u) greater than configured (%u), clipping\n",
ncores, NR_CPUS);
ncores = NR_CPUS;
}
for (i = 0; i < ncores; i++) for (i = 0; i < ncores; i++)
cpu_set(i, cpu_possible_map); cpu_set(i, cpu_possible_map);
} }
......
...@@ -129,12 +129,6 @@ void __init smp_init_cpus(void) ...@@ -129,12 +129,6 @@ void __init smp_init_cpus(void)
unsigned int i, ncores = get_core_count(); unsigned int i, ncores = get_core_count();
/* sanity check */ /* sanity check */
if (ncores == 0) {
printk(KERN_ERR
"U8500: strange CM count of 0? Default to 1\n");
ncores = 1;
}
if (ncores > NR_CPUS) { if (ncores > NR_CPUS) {
printk(KERN_WARNING printk(KERN_WARNING
"U8500: no. of cores (%d) greater than configured " "U8500: no. of cores (%d) greater than configured "
......
...@@ -124,13 +124,6 @@ void __init smp_init_cpus(void) ...@@ -124,13 +124,6 @@ void __init smp_init_cpus(void)
ncores = scu_base ? scu_get_core_count(scu_base) : 1; ncores = scu_base ? scu_get_core_count(scu_base) : 1;
/* sanity check */ /* sanity check */
if (ncores == 0) {
printk(KERN_ERR
"vexpress: strange CM count of 0? Default to 1\n");
ncores = 1;
}
if (ncores > NR_CPUS) { if (ncores > NR_CPUS) {
printk(KERN_WARNING printk(KERN_WARNING
"vexpress: no. of cores (%d) greater than configured " "vexpress: no. of cores (%d) greater than configured "
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment