]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
arm: mach-zynq: platsmp: Fix CPU presence check
authorPeter Crosthwaite <peter.crosthwaite@xilinx.com>
Thu, 25 Jul 2013 01:54:21 +0000 (11:54 +1000)
committerMichal Simek <michal.simek@xilinx.com>
Fri, 23 Aug 2013 13:01:27 +0000 (15:01 +0200)
Fix an off-by-one error in the logic that checks if a CPU is present.
The ncores variable is a count of cores while the cpu variable is a
0 based index. So if ncores == cpu, cpu is out of range. Fix this
comparison so non-existent CPUs are not probed.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
arch/arm/mach-zynq/platsmp.c

index ef261e8cd51fe01d121f62a02fa2e16b00592297..a83fb65939292d523b826993eb98fb1fcc65b7c2 100644 (file)
@@ -54,7 +54,7 @@ int __cpuinit zynq_cpun_start(u32 address, int cpu)
        u32 trampoline_code_size = &zynq_secondary_trampoline_end -
                                                &zynq_secondary_trampoline;
 
-       if (cpu > ncores) {
+       if (cpu >= ncores) {
                pr_warn("CPU No. is not available in the system\n");
                return -1;
        }