powerpc/smp: Do not BUG_ON if invalid CPU during kick
authorSantosh Sivaraj <santosh@fossix.org>
Tue, 27 Jun 2017 07:00:05 +0000 (12:30 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 28 Jun 2017 03:08:16 +0000 (13:08 +1000)
During secondary start, we do not need to BUG_ON if an invalid CPU number
is passed. We already print an error if secondary cannot be started, so
just return an error instead.

Signed-off-by: Santosh Sivaraj <santosh@fossix.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/kernel/smp.c
arch/powerpc/platforms/cell/smp.c
arch/powerpc/platforms/powernv/smp.c
arch/powerpc/platforms/pseries/smp.c

index df2a41647d8ed3a2ab4816084c5ae9f70faa4ad0..05bf5836107cc286bf750df10ea5c1f188c9c6f1 100644 (file)
@@ -112,7 +112,8 @@ int smp_generic_cpu_bootable(unsigned int nr)
 #ifdef CONFIG_PPC64
 int smp_generic_kick_cpu(int nr)
 {
-       BUG_ON(nr < 0 || nr >= NR_CPUS);
+       if (nr < 0 || nr >= NR_CPUS)
+               return -EINVAL;
 
        /*
         * The processor is currently spinning, waiting for the
index 895560f4be69ac0bc1d71de7e11919a0ba69524c..ee8c535cf4d3d3b8e4de5056f3367f7df5adc910 100644 (file)
@@ -115,7 +115,8 @@ static void smp_cell_setup_cpu(int cpu)
 
 static int smp_cell_kick_cpu(int nr)
 {
-       BUG_ON(nr < 0 || nr >= NR_CPUS);
+       if (nr < 0 || nr >= NR_CPUS)
+               return -EINVAL;
 
        if (!smp_startup_cpu(nr))
                return -ENOENT;
index c04c87adad94561ad7ef8c6170c1165f08e5e5b2..292825f25ffdf19bd78e6f2d126893649814955a 100644 (file)
@@ -63,7 +63,8 @@ static int pnv_smp_kick_cpu(int nr)
        long rc;
        uint8_t status;
 
-       BUG_ON(nr < 0 || nr >= NR_CPUS);
+       if (nr < 0 || nr >= NR_CPUS)
+               return -EINVAL;
 
        /*
         * If we already started or OPAL is not supported, we just
index 52ca6b311d44e913c755ba2b592a7e16a14ffe54..c82182ac40af1104f807ad32a9e3181625c1d422 100644 (file)
@@ -151,7 +151,8 @@ static void smp_setup_cpu(int cpu)
 
 static int smp_pSeries_kick_cpu(int nr)
 {
-       BUG_ON(nr < 0 || nr >= NR_CPUS);
+       if (nr < 0 || nr >= NR_CPUS)
+               return -EINVAL;
 
        if (!smp_startup_cpu(nr))
                return -ENOENT;