From patchwork Mon Jan 25 01:15:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 572535 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 6E125140A98 for ; Mon, 25 Jan 2016 12:22:20 +1100 (AEDT) Received: from localhost ([::1]:34059 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aNVrG-0001Kr-EB for incoming@patchwork.ozlabs.org; Sun, 24 Jan 2016 20:22:18 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47759) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aNVjq-0002aW-Nf for qemu-devel@nongnu.org; Sun, 24 Jan 2016 20:14:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aNVjo-0000d1-4z for qemu-devel@nongnu.org; Sun, 24 Jan 2016 20:14:38 -0500 Received: from ozlabs.org ([103.22.144.67]:52105) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aNVjn-0000bC-Pu; Sun, 24 Jan 2016 20:14:36 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 7A956140BCD; Mon, 25 Jan 2016 12:14:32 +1100 (AEDT) From: David Gibson To: peter.maydell@linaro.org Date: Mon, 25 Jan 2016 12:15:16 +1100 Message-Id: <1453684527-23564-18-git-send-email-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1453684527-23564-1-git-send-email-david@gibson.dropbear.id.au> References: <1453684527-23564-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: 103.22.144.67 Cc: lvivier@redhat.com, thuth@redhat.com, mark.cave-ayland@ilande.co.uk, agraf@suse.de, qemu-devel@nongnu.org, qemu-ppc@nongnu.org, bharata@linux.vnet.ibm.com, David Gibson , gkurz@linux.vnet.ibm.com Subject: [Qemu-devel] [PULL 17/28] 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 b93dc10..4d88a29 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 {