qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org
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
Date: Wed, 29 Apr 2015 21:01:07 +0200	[thread overview]
Message-ID: <1430334068-12772-2-git-send-email-thuth@redhat.com> (raw)
In-Reply-To: <1430334068-12772-1-git-send-email-thuth@redhat.com>

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 <thuth@redhat.com>
---
 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);
-- 
1.8.3.1

  reply	other threads:[~2015-04-29 19:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-29 19:01 [Qemu-devel] [PATCH 0/2] hw/ppc/spapr: Improve error printing Thomas Huth
2015-04-29 19:01 ` Thomas Huth [this message]
2015-04-29 19:01 ` [Qemu-devel] [PATCH 2/2] hw/ppc/spapr: Use error_report() instead of hw_error() Thomas Huth
2015-04-30  3:32   ` Alexey Kardashevskiy
2015-04-30 17:03     ` Thomas Huth
2015-05-01  3:42       ` David Gibson
2015-04-30  1:02 ` [Qemu-devel] [PATCH 0/2] hw/ppc/spapr: Improve error printing David Gibson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1430334068-12772-2-git-send-email-thuth@redhat.com \
    --to=thuth@redhat.com \
    --cc=agraf@suse.de \
    --cc=aik@ozlabs.ru \
    --cc=david@gibson.dropbear.id.au \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).