Message ID | 20170522181821.29482-2-drjones@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 22.05.2017 20:18, Andrew Jones wrote: > Signed-off-by: Andrew Jones <drjones@redhat.com> > --- > lib/arm/setup.c | 7 ++----- > lib/powerpc/setup.c | 8 ++------ > 2 files changed, 4 insertions(+), 11 deletions(-) > > diff --git a/lib/arm/setup.c b/lib/arm/setup.c > index 689c211d3018..9974b4c131dd 100644 > --- a/lib/arm/setup.c > +++ b/lib/arm/setup.c > @@ -48,11 +48,8 @@ static void cpu_set(int fdtnode __unused, u64 regval, void *info __unused) > { > int cpu = nr_cpus++; > > - if (cpu >= NR_CPUS) { > - printf("Number cpus exceeds maximum supported (%d).\n", > - NR_CPUS); > - assert(0); > - } > + assert_msg(cpu < NR_CPUS, "Number cpus exceeds maximum supported (%d).", NR_CPUS); > + > cpus[cpu] = regval; > set_cpu_present(cpu, true); > } > diff --git a/lib/powerpc/setup.c b/lib/powerpc/setup.c > index 8d44311cac3b..7157bcb70094 100644 > --- a/lib/powerpc/setup.c > +++ b/lib/powerpc/setup.c > @@ -50,15 +50,11 @@ static void cpu_set(int fdtnode, u64 regval, void *info) > struct cpu_set_params *params = info; > int cpu = nr_cpus++; > > - if (cpu >= NR_CPUS) { > - printf("Number cpus exceeds maximum supported (%d).\n", > - NR_CPUS); > - assert(0); > - } > + assert_msg(cpu < NR_CPUS, "Number cpus exceeds maximum supported (%d).", NR_CPUS); > + > cpus[cpu] = regval; > > /* set exception stack address for this CPU (in SPGR0) */ > - > asm volatile ("mtsprg0 %[addr]" :: > [addr] "r" (exception_stack[cpu + 1])); Reviewed-by: Thomas Huth <thuth@redhat.com>
diff --git a/lib/arm/setup.c b/lib/arm/setup.c index 689c211d3018..9974b4c131dd 100644 --- a/lib/arm/setup.c +++ b/lib/arm/setup.c @@ -48,11 +48,8 @@ static void cpu_set(int fdtnode __unused, u64 regval, void *info __unused) { int cpu = nr_cpus++; - if (cpu >= NR_CPUS) { - printf("Number cpus exceeds maximum supported (%d).\n", - NR_CPUS); - assert(0); - } + assert_msg(cpu < NR_CPUS, "Number cpus exceeds maximum supported (%d).", NR_CPUS); + cpus[cpu] = regval; set_cpu_present(cpu, true); } diff --git a/lib/powerpc/setup.c b/lib/powerpc/setup.c index 8d44311cac3b..7157bcb70094 100644 --- a/lib/powerpc/setup.c +++ b/lib/powerpc/setup.c @@ -50,15 +50,11 @@ static void cpu_set(int fdtnode, u64 regval, void *info) struct cpu_set_params *params = info; int cpu = nr_cpus++; - if (cpu >= NR_CPUS) { - printf("Number cpus exceeds maximum supported (%d).\n", - NR_CPUS); - assert(0); - } + assert_msg(cpu < NR_CPUS, "Number cpus exceeds maximum supported (%d).", NR_CPUS); + cpus[cpu] = regval; /* set exception stack address for this CPU (in SPGR0) */ - asm volatile ("mtsprg0 %[addr]" :: [addr] "r" (exception_stack[cpu + 1]));
Signed-off-by: Andrew Jones <drjones@redhat.com> --- lib/arm/setup.c | 7 ++----- lib/powerpc/setup.c | 8 ++------ 2 files changed, 4 insertions(+), 11 deletions(-)