From patchwork Thu Oct 31 16:10:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Soren Brinkmann X-Patchwork-Id: 3121091 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0DE48C146B for ; Thu, 31 Oct 2013 16:11:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E9CF520125 for ; Thu, 31 Oct 2013 16:11:34 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B558720266 for ; Thu, 31 Oct 2013 16:11:32 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vbuq0-0001RS-RG; Thu, 31 Oct 2013 16:11:13 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vbupv-0004LG-1i; Thu, 31 Oct 2013 16:11:07 +0000 Received: from mail-pd0-x229.google.com ([2607:f8b0:400e:c02::229]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vbupg-0004HT-55 for linux-arm-kernel@lists.infradead.org; Thu, 31 Oct 2013 16:10:53 +0000 Received: by mail-pd0-f169.google.com with SMTP id q10so2623697pdj.28 for ; Thu, 31 Oct 2013 09:10:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=O9+9ASt1SIOb7uubk45R4WIeqxJNJnFxM3QwGrE95zY=; b=FO/xhe+5WgbMJnFZzZja9esyaur237IDzi52TTuEKizBjyOHe/wYO0zl2HDAtaNbHg l27xqEDX/hSEUhiZF4QtMgqkEBMz9I9FFGRhx91EFVH/0NJt5Nay2lPSGB2u37xyQce5 Ly83tpYV4xui7EBmKmfF3EdGGaZQOr5gGtSdb9uuk0+mS6YNT2LCw7ZvHqVg3OwWx7d2 GETggrkTyE2vgCgsdhWDgDP9uoOZnmpBaakllGzaMgobfWpmPOv1vgNMtRjjACE1xE6Q /oMBkIZk2hz35gq1fVkoAYx6llaaZ5vUjYcDQ6Ijo/7MEF25J/YrzvCkqdMHSg15WzQ1 65lQ== X-Received: by 10.66.26.236 with SMTP id o12mr2728239pag.136.1383235831847; Thu, 31 Oct 2013 09:10:31 -0700 (PDT) Received: from localhost ([149.199.62.254]) by mx.google.com with ESMTPSA id ve9sm5080858pbc.19.2013.10.31.09.10.30 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 31 Oct 2013 09:10:30 -0700 (PDT) From: Soren Brinkmann To: Michal Simek , Russell King 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131031_121052_367357_16724579 X-CRM114-Status: GOOD ( 12.00 ) X-Spam-Score: -1.9 (-) Cc: linux-arm-kernel@lists.infradead.org, Peter Crosthwaite , linux-kernel@vger.kernel.org, =?UTF-8?q?S=C3=B6ren=20Brinkmann?= X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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; }