From: Thomas Huth Subject: Re: [PATCH kvm-unit-tests 1/2] arm/powerpc: setup: apply assert_msg Date: Mon, 22 May 2017 22:05:58 +0200 Message-ID: References: <20170522181821.29482-1-drjones@redhat.com> <20170522181821.29482-2-drjones@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: pbonzini@redhat.com, rkrcmar@redhat.com, lvivier@redhat.com To: Andrew Jones , kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:54374 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1762017AbdEVUGC (ORCPT ); Mon, 22 May 2017 16:06:02 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5850680476 for ; Mon, 22 May 2017 20:06:01 +0000 (UTC) In-Reply-To: <20170522181821.29482-2-drjones@redhat.com> Content-Language: en-US Sender: kvm-owner@vger.kernel.org List-ID: On 22.05.2017 20:18, Andrew Jones wrote: > Signed-off-by: Andrew Jones > --- > 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