Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755300Ab3JaQKe (ORCPT ); Thu, 31 Oct 2013 12:10:34 -0400 Received: from mail-pa0-f43.google.com ([209.85.220.43]:43369 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755232Ab3JaQKc (ORCPT ); Thu, 31 Oct 2013 12:10:32 -0400 From: Soren Brinkmann To: Michal Simek , Russell King Cc: =?UTF-8?q?S=C3=B6ren=20Brinkmann?= , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Peter Crosthwaite Subject: [PATCH 1/6] arm: zynq: platsmp: Fix CPU presence check Date: Thu, 31 Oct 2013 09:10:14 -0700 Message-Id: <1383235819-2552-2-git-send-email-soren.brinkmann@xilinx.com> X-Mailer: git-send-email 1.8.4.1 In-Reply-To: <1383235819-2552-1-git-send-email-soren.brinkmann@xilinx.com> References: <1383235819-2552-1-git-send-email-soren.brinkmann@xilinx.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1235 Lines: 34 From: Peter Crosthwaite 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 Signed-off-by: Michal Simek --- arch/arm/mach-zynq/platsmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-zynq/platsmp.c b/arch/arm/mach-zynq/platsmp.c index 689fbbc3d9c8..2512624e657d 100644 --- a/arch/arm/mach-zynq/platsmp.c +++ b/arch/arm/mach-zynq/platsmp.c @@ -39,7 +39,7 @@ int 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; } -- 1.8.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/