From patchwork Fri Jan 29 05:06:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 8158671 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BD7C5BEEE5 for ; Fri, 29 Jan 2016 05:10:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 219D8201D3 for ; Fri, 29 Jan 2016 05:10:12 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6594D201CD for ; Fri, 29 Jan 2016 05:10:11 +0000 (UTC) Received: from localhost ([::1]:59807 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aP1Jy-0002MQ-OI for patchwork-qemu-devel@patchwork.kernel.org; Fri, 29 Jan 2016 00:10:10 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38428) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aP1GL-0003Wz-MM for qemu-devel@nongnu.org; Fri, 29 Jan 2016 00:06:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aP1GJ-0001QZ-Bp for qemu-devel@nongnu.org; Fri, 29 Jan 2016 00:06:25 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:39566) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aP1GI-0001L2-VQ; Fri, 29 Jan 2016 00:06:23 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 07AD0140C63; Fri, 29 Jan 2016 16:06:17 +1100 (AEDT) From: David Gibson To: peter.maydell@linaro.org, agraf@suse.de Date: Fri, 29 Jan 2016 16:06:49 +1100 Message-Id: <1454044031-5930-19-git-send-email-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1454044031-5930-1-git-send-email-david@gibson.dropbear.id.au> References: <1454044031-5930-1-git-send-email-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2401:3900:2:1::2 Cc: aik@ozlabs.ru, mdroth@linux.vnet.ibm.com, qemu-devel@nongnu.org, qemu-ppc@nongnu.org, David Gibson Subject: [Qemu-devel] [PULL 17/39] pseries: Clean up error reporting in ppc_spapr_init() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This function includes a number of explicit fprintf()s for errors. Change these to use error_report() instead. Also replace the single exit(EXIT_FAILURE) with an explicit exit(1), since the latter is the more usual idiom in qemu by a large margin. Signed-off-by: David Gibson Reviewed-by: Alexey Kardashevskiy Reviewed-by: Markus Armbruster --- hw/ppc/spapr.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 59f0a16..f8404d3 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1788,8 +1788,8 @@ static void ppc_spapr_init(MachineState *machine) } if (spapr->rma_size > node0_size) { - fprintf(stderr, "Error: Numa node 0 has to span the RMA (%#08"HWADDR_PRIx")\n", - spapr->rma_size); + error_report("Numa node 0 has to span the RMA (%#08"HWADDR_PRIx")", + spapr->rma_size); exit(1); } @@ -1855,10 +1855,10 @@ static void ppc_spapr_init(MachineState *machine) ram_addr_t hotplug_mem_size = machine->maxram_size - machine->ram_size; if (machine->ram_slots > SPAPR_MAX_RAM_SLOTS) { - error_report("Specified number of memory slots %" PRIu64 - " exceeds max supported %d", + error_report("Specified number of memory slots %" + PRIu64" exceeds max supported %d", machine->ram_slots, SPAPR_MAX_RAM_SLOTS); - exit(EXIT_FAILURE); + exit(1); } spapr->hotplug_memory.base = ROUND_UP(machine->ram_size, @@ -1954,8 +1954,9 @@ static void ppc_spapr_init(MachineState *machine) } if (spapr->rma_size < (MIN_RMA_SLOF << 20)) { - fprintf(stderr, "qemu: pSeries SLOF firmware requires >= " - "%ldM guest RMA (Real Mode Area memory)\n", MIN_RMA_SLOF); + error_report( + "pSeries SLOF firmware requires >= %ldM guest RMA (Real Mode Area memory)", + MIN_RMA_SLOF); exit(1); } @@ -1971,8 +1972,8 @@ static void ppc_spapr_init(MachineState *machine) kernel_le = kernel_size > 0; } if (kernel_size < 0) { - fprintf(stderr, "qemu: error loading %s: %s\n", - kernel_filename, load_elf_strerror(kernel_size)); + error_report("error loading %s: %s", + kernel_filename, load_elf_strerror(kernel_size)); exit(1); } @@ -1985,8 +1986,8 @@ static void ppc_spapr_init(MachineState *machine) initrd_size = load_image_targphys(initrd_filename, initrd_base, load_limit - initrd_base); if (initrd_size < 0) { - fprintf(stderr, "qemu: could not load initial ram disk '%s'\n", - initrd_filename); + error_report("could not load initial ram disk '%s'", + initrd_filename); exit(1); } } else {