提交 76d98ab4 编写于 作者: S Santosh Sivaraj 提交者: Michael Ellerman

powerpc/powernv: Get cpu only after validity check

Check for validity of cpu before calling get_hard_smp_processor_id().

Found with coverity.
Signed-off-by: NSantosh Sivaraj <santosh@fossix.org>
Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
上级 520eccdf
...@@ -57,7 +57,7 @@ static void pnv_smp_setup_cpu(int cpu) ...@@ -57,7 +57,7 @@ static void pnv_smp_setup_cpu(int cpu)
static int pnv_smp_kick_cpu(int nr) static int pnv_smp_kick_cpu(int nr)
{ {
unsigned int pcpu = get_hard_smp_processor_id(nr); unsigned int pcpu;
unsigned long start_here = unsigned long start_here =
__pa(ppc_function_entry(generic_secondary_smp_init)); __pa(ppc_function_entry(generic_secondary_smp_init));
long rc; long rc;
...@@ -66,6 +66,7 @@ static int pnv_smp_kick_cpu(int nr) ...@@ -66,6 +66,7 @@ static int pnv_smp_kick_cpu(int nr)
if (nr < 0 || nr >= nr_cpu_ids) if (nr < 0 || nr >= nr_cpu_ids)
return -EINVAL; return -EINVAL;
pcpu = get_hard_smp_processor_id(nr);
/* /*
* If we already started or OPAL is not supported, we just * If we already started or OPAL is not supported, we just
* kick the CPU via the PACA * kick the CPU via the PACA
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册