mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Soren Brinkmann <soren.brinkmann@xilinx.com>
To: Michal Simek <michal.simek@xilinx.com>,
	Russell King <linux@arm.linux.org.uk>
Cc: "Sören Brinkmann" <soren.brinkmann@xilinx.com>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	"Peter Crosthwaite" <peter.crosthwaite@xilinx.com>
Subject: [PATCH 1/6] arm: zynq: platsmp: Fix CPU presence check
Date: Thu, 31 Oct 2013 09:10:14 -0700	[thread overview]
Message-ID: <1383235819-2552-2-git-send-email-soren.brinkmann@xilinx.com> (raw)
In-Reply-To: <1383235819-2552-1-git-send-email-soren.brinkmann@xilinx.com>

From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>

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 | 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


  reply	other threads:[~2013-10-31 16:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-31 16:10 [PATCH 0/6] arm: zynq: BSP update Soren Brinkmann
2013-10-31 16:10 ` Soren Brinkmann [this message]
2013-10-31 16:17   ` [PATCH 1/6] arm: zynq: platsmp: Fix CPU presence check Russell King - ARM Linux
2013-10-31 17:37     ` [PATCH] arm: zynq: platsmp: Remove " Soren Brinkmann
2013-10-31 16:42   ` [PATCH 1/6] arm: zynq: platsmp: Fix " Sudeep KarkadaNagesha
2013-10-31 16:10 ` [PATCH 2/6] arm: zynq: Invalidate L1 in secondary boot Soren Brinkmann
2013-10-31 16:10 ` [PATCH 3/6] arm: zynq: Add support for zynq_cpu_kill function Soren Brinkmann
2013-10-31 16:10 ` [PATCH 4/6] arm: zynq: Use of_platform_populate instead of bus_probe Soren Brinkmann
2013-10-31 16:10 ` [PATCH 5/6] arm: zynq: Set proper GIC flags Soren Brinkmann
2013-10-31 16:10 ` [PATCH 6/6] arm: zynq: headsmp: Move .glbl out of actual code Soren Brinkmann
2013-11-06  7:46   ` Michal Simek
2013-11-06 16:41     ` Sören Brinkmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1383235819-2552-2-git-send-email-soren.brinkmann@xilinx.com \
    --to=soren.brinkmann@xilinx.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=michal.simek@xilinx.com \
    --cc=peter.crosthwaite@xilinx.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome