]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
ARM: SMP: Clean up ncores sanity checks
authorRussell King <rmk+kernel@arm.linux.org.uk>
Fri, 3 Dec 2010 19:29:53 +0000 (19:29 +0000)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Mon, 20 Dec 2010 15:08:27 +0000 (15:08 +0000)
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: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mach-omap2/omap-smp.c
arch/arm/mach-realview/platsmp.c
arch/arm/mach-s5pv310/platsmp.c
arch/arm/mach-tegra/platsmp.c
arch/arm/mach-ux500/platsmp.c
arch/arm/mach-vexpress/platsmp.c

index 3c87468ce9cbb59dfa5cb06f20d4960c9a3c57e8..5f10f38354aeaadd9b0e169684c34de3d6a36511 100644 (file)
@@ -121,12 +121,6 @@ void __init smp_init_cpus(void)
        ncores = get_core_count();
 
        /* sanity check */
-       if (ncores == 0) {
-               printk(KERN_ERR
-                      "OMAP4: strange core count of 0? Default to 1\n");
-               ncores = 1;
-       }
-
        if (ncores > NR_CPUS) {
                printk(KERN_WARNING
                       "OMAP4: no. of cores (%d) greater than configured "
index 108e92f9746b095ae16fcaea14f118bb8fa82a39..13116cd37639a596d8ae154d08b58447d8be19e0 100644 (file)
@@ -161,13 +161,6 @@ void __init smp_init_cpus(void)
        unsigned int i, ncores = get_core_count();
 
        /* sanity check */
-       if (ncores == 0) {
-               printk(KERN_ERR
-                      "Realview: strange CM count of 0? Default to 1\n");
-
-               ncores = 1;
-       }
-
        if (ncores > NR_CPUS) {
                printk(KERN_WARNING
                       "Realview: no. of cores (%d) greater than configured "
index d474426f37b7549ba544b68f9da8f80d44d3624d..560ada83b0b14b38f2a0f906b815b2c102103d9f 100644 (file)
@@ -130,13 +130,6 @@ void __init smp_init_cpus(void)
        ncores = scu_base ? scu_get_core_count(scu_base) : 1;
 
        /* sanity check */
-       if (ncores == 0) {
-               printk(KERN_ERR
-                      "S5PV310: strange CM count of 0? Default to 1\n");
-
-               ncores = 1;
-       }
-
        if (ncores > NR_CPUS) {
                printk(KERN_WARNING
                       "S5PV310: no. of cores (%d) greater than configured "
index 1c0fd92cab39e44779a3823e89d5248997163a72..5b194dd815a8a7b3aed9a7d38c15d3a5589bef5b 100644 (file)
@@ -117,6 +117,12 @@ void __init smp_init_cpus(void)
 {
        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++)
                cpu_set(i, cpu_possible_map);
 }
index a51962b7579baa1a8f589c95524f89e7f62d8f8e..e31024e3a7cccd2c7d149dc5604381b9c1e4db56 100644 (file)
@@ -129,12 +129,6 @@ void __init smp_init_cpus(void)
        unsigned int i, ncores = get_core_count();
 
        /* sanity check */
-       if (ncores == 0) {
-               printk(KERN_ERR
-                      "U8500: strange CM count of 0? Default to 1\n");
-               ncores = 1;
-       }
-
        if (ncores > NR_CPUS) {
                printk(KERN_WARNING
                       "U8500: no. of cores (%d) greater than configured "
index 276f916014c1cdb5cca2cc4a99346136b8c3473a..b5a75868366836d43a8b79cd94a032b71f8c4010 100644 (file)
@@ -124,13 +124,6 @@ void __init smp_init_cpus(void)
        ncores = scu_base ? scu_get_core_count(scu_base) : 1;
 
        /* sanity check */
-       if (ncores == 0) {
-               printk(KERN_ERR
-                      "vexpress: strange CM count of 0? Default to 1\n");
-
-               ncores = 1;
-       }
-
        if (ncores > NR_CPUS) {
                printk(KERN_WARNING
                       "vexpress: no. of cores (%d) greater than configured "