From: Andrew Jones Subject: [PATCH kvm-unit-tests 1/2] arm/powerpc: setup: apply assert_msg Date: Mon, 22 May 2017 20:18:20 +0200 Message-ID: <20170522181821.29482-2-drjones@redhat.com> References: <20170522181821.29482-1-drjones@redhat.com> Cc: pbonzini@redhat.com, rkrcmar@redhat.com, lvivier@redhat.com, thuth@redhat.com To: kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:44202 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933803AbdEVSS2 (ORCPT ); Mon, 22 May 2017 14:18:28 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AFF85C04B930 for ; Mon, 22 May 2017 18:18:27 +0000 (UTC) In-Reply-To: <20170522181821.29482-1-drjones@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: 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])); -- 2.9.3