From patchwork Wed Apr 29 19:01:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 466237 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 654D814007D for ; Thu, 30 Apr 2015 05:02:48 +1000 (AEST) Received: from localhost ([::1]:40583 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YnXFu-0003X6-EK for incoming@patchwork.ozlabs.org; Wed, 29 Apr 2015 15:02:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34714) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YnXEY-0000O7-Sl for qemu-devel@nongnu.org; Wed, 29 Apr 2015 15:01:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YnXES-0008V0-9B for qemu-devel@nongnu.org; Wed, 29 Apr 2015 15:01:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36468) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YnXES-0008Uw-3t; Wed, 29 Apr 2015 15:01:16 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id A20B28E765; Wed, 29 Apr 2015 19:01:15 +0000 (UTC) Received: from thh440s.redhat.com (vpn1-6-107.ams2.redhat.com [10.36.6.107]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t3TJ18JO012609; Wed, 29 Apr 2015 15:01:13 -0400 From: Thomas Huth To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Date: Wed, 29 Apr 2015 21:01:07 +0200 Message-Id: <1430334068-12772-2-git-send-email-thuth@redhat.com> In-Reply-To: <1430334068-12772-1-git-send-email-thuth@redhat.com> References: <1430334068-12772-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: aik@ozlabs.ru, agraf@suse.de, david@gibson.dropbear.id.au Subject: [Qemu-devel] [PATCH 1/2] hw/ppc/spapr: Fix error message when firmware could not be loaded 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 When specifying a non-existing file with the "-bios" parameter, QEMU complained that it "could not find LPAR rtas". That's obviously a copy-n-paste bug from the code which loads the spapr-rtas.bin, it should complain about a missing firmware file instead. Additionally the error message was printed with hw_error() - which also dumps the whole CPU state. However, this does not make much sense here since the CPU is not running yet and thus the registers only contain zeroes. So let's use error_report() here instead. And while we're at it, let's also bail out if the firmware file had zero length. Signed-off-by: Thomas Huth --- hw/ppc/spapr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 61ddc79..226f029 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1641,12 +1641,12 @@ static void ppc_spapr_init(MachineState *machine) } filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (!filename) { - hw_error("Could not find LPAR rtas '%s'\n", bios_name); + error_report("Could not find LPAR firmware '%s'", bios_name); exit(1); } fw_size = load_image_targphys(filename, 0, FW_MAX_SIZE); - if (fw_size < 0) { - hw_error("qemu: could not load LPAR rtas '%s'\n", filename); + if (fw_size <= 0) { + error_report("Could not load LPAR firmware '%s'", filename); exit(1); } g_free(filename);