diff mbox

[2/2] hw/ppc/spapr: Use error_report() instead of hw_error()

Message ID 1430334068-12772-3-git-send-email-thuth@redhat.com
State New
Headers show

Commit Message

Thomas Huth April 29, 2015, 7:01 p.m. UTC
hw_error() is designed for printing CPU-related error messages
(e.g. it also prints a full CPU register dump). For error messages
that are not directly related to CPU problems, a function like
error_report() should be used instead.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 hw/ppc/spapr.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Alexey Kardashevskiy April 30, 2015, 3:32 a.m. UTC | #1
On 04/30/2015 05:01 AM, Thomas Huth wrote:
> hw_error() is designed for printing CPU-related error messages
> (e.g. it also prints a full CPU register dump). For error messages
> that are not directly related to CPU problems, a function like
> error_report() should be used instead.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>   hw/ppc/spapr.c | 12 ++++++------
>   1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 226f029..92b1c0b 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -794,8 +794,8 @@ static void spapr_finalize_fdt(sPAPREnvironment *spapr,
>       _FDT((fdt_pack(fdt)));
>
>       if (fdt_totalsize(fdt) > FDT_MAX_SIZE) {
> -        hw_error("FDT too big ! 0x%x bytes (max is 0x%x)\n",
> -                 fdt_totalsize(fdt), FDT_MAX_SIZE);
> +        error_report("FDT too big ! 0x%x bytes (max is 0x%x)",
> +                     fdt_totalsize(fdt), FDT_MAX_SIZE);

You did adjust indent here...


>           exit(1);
>       }
>
> @@ -1419,7 +1419,7 @@ static void ppc_spapr_init(MachineState *machine)
>       rma_alloc_size = kvmppc_alloc_rma(&rma);
>
>       if (rma_alloc_size == -1) {
> -        hw_error("qemu: Unable to create RMA\n");
> +        error_report("Unable to create RMA");
>           exit(1);
>       }
>
> @@ -1520,17 +1520,17 @@ static void ppc_spapr_init(MachineState *machine)
>
>       filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, "spapr-rtas.bin");
>       if (!filename) {
> -        hw_error("Could not find LPAR rtas '%s'\n", "spapr-rtas.bin");
> +        error_report("Could not find LPAR rtas '%s'", "spapr-rtas.bin");
>           exit(1);
>       }
>       spapr->rtas_size = get_image_size(filename);
>       spapr->rtas_blob = g_malloc(spapr->rtas_size);
>       if (load_image_size(filename, spapr->rtas_blob, spapr->rtas_size) < 0) {
> -        hw_error("qemu: could not load LPAR rtas '%s'\n", filename);
> +        error_report("Could not load LPAR rtas '%s'", filename);
>           exit(1);
>       }
>       if (spapr->rtas_size > RTAS_MAX_SIZE) {
> -        hw_error("RTAS too big ! 0x%zx bytes (max is 0x%x)\n",
> +        error_report("RTAS too big ! 0x%zx bytes (max is 0x%x)",
>                    (size_t)spapr->rtas_size, RTAS_MAX_SIZE);

... but not here :)


>           exit(1);
>       }
>
Thomas Huth April 30, 2015, 5:03 p.m. UTC | #2
On Thu, 30 Apr 2015 13:32:05 +1000
Alexey Kardashevskiy <aik@ozlabs.ru> wrote:

> On 04/30/2015 05:01 AM, Thomas Huth wrote:
> > hw_error() is designed for printing CPU-related error messages
> > (e.g. it also prints a full CPU register dump). For error messages
> > that are not directly related to CPU problems, a function like
> > error_report() should be used instead.
> >
> > Signed-off-by: Thomas Huth <thuth@redhat.com>
> > ---
> >   hw/ppc/spapr.c | 12 ++++++------
> >   1 file changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> > index 226f029..92b1c0b 100644
> > --- a/hw/ppc/spapr.c
> > +++ b/hw/ppc/spapr.c
> > @@ -794,8 +794,8 @@ static void spapr_finalize_fdt(sPAPREnvironment *spapr,
> >       _FDT((fdt_pack(fdt)));
> >
> >       if (fdt_totalsize(fdt) > FDT_MAX_SIZE) {
> > -        hw_error("FDT too big ! 0x%x bytes (max is 0x%x)\n",
> > -                 fdt_totalsize(fdt), FDT_MAX_SIZE);
> > +        error_report("FDT too big ! 0x%x bytes (max is 0x%x)",
> > +                     fdt_totalsize(fdt), FDT_MAX_SIZE);
> 
> You did adjust indent here...
> 
> 
> >           exit(1);
> >       }
> >
> > @@ -1419,7 +1419,7 @@ static void ppc_spapr_init(MachineState *machine)
> >       rma_alloc_size = kvmppc_alloc_rma(&rma);
> >
> >       if (rma_alloc_size == -1) {
> > -        hw_error("qemu: Unable to create RMA\n");
> > +        error_report("Unable to create RMA");
> >           exit(1);
> >       }
> >
> > @@ -1520,17 +1520,17 @@ static void ppc_spapr_init(MachineState *machine)
> >
> >       filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, "spapr-rtas.bin");
> >       if (!filename) {
> > -        hw_error("Could not find LPAR rtas '%s'\n", "spapr-rtas.bin");
> > +        error_report("Could not find LPAR rtas '%s'", "spapr-rtas.bin");
> >           exit(1);
> >       }
> >       spapr->rtas_size = get_image_size(filename);
> >       spapr->rtas_blob = g_malloc(spapr->rtas_size);
> >       if (load_image_size(filename, spapr->rtas_blob, spapr->rtas_size) < 0) {
> > -        hw_error("qemu: could not load LPAR rtas '%s'\n", filename);
> > +        error_report("Could not load LPAR rtas '%s'", filename);
> >           exit(1);
> >       }
> >       if (spapr->rtas_size > RTAS_MAX_SIZE) {
> > -        hw_error("RTAS too big ! 0x%zx bytes (max is 0x%x)\n",
> > +        error_report("RTAS too big ! 0x%zx bytes (max is 0x%x)",
> >                    (size_t)spapr->rtas_size, RTAS_MAX_SIZE);
> 
> ... but not here :)

Alexey, you're right, of course.

David, since you already picked up that patch, could you maybe amend
this cosmetic cleanup to my patch? Or shall I send a new version of the
patch or a fixup patch?

 Thomas
David Gibson May 1, 2015, 3:42 a.m. UTC | #3
On Thu, Apr 30, 2015 at 07:03:20PM +0200, Thomas Huth wrote:
> On Thu, 30 Apr 2015 13:32:05 +1000
> Alexey Kardashevskiy <aik@ozlabs.ru> wrote:
> 
> > On 04/30/2015 05:01 AM, Thomas Huth wrote:
> > > hw_error() is designed for printing CPU-related error messages
> > > (e.g. it also prints a full CPU register dump). For error messages
> > > that are not directly related to CPU problems, a function like
> > > error_report() should be used instead.
> > >
> > > Signed-off-by: Thomas Huth <thuth@redhat.com>
> > > ---
> > >   hw/ppc/spapr.c | 12 ++++++------
> > >   1 file changed, 6 insertions(+), 6 deletions(-)
> > >
> > > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> > > index 226f029..92b1c0b 100644
> > > --- a/hw/ppc/spapr.c
> > > +++ b/hw/ppc/spapr.c
> > > @@ -794,8 +794,8 @@ static void spapr_finalize_fdt(sPAPREnvironment *spapr,
> > >       _FDT((fdt_pack(fdt)));
> > >
> > >       if (fdt_totalsize(fdt) > FDT_MAX_SIZE) {
> > > -        hw_error("FDT too big ! 0x%x bytes (max is 0x%x)\n",
> > > -                 fdt_totalsize(fdt), FDT_MAX_SIZE);
> > > +        error_report("FDT too big ! 0x%x bytes (max is 0x%x)",
> > > +                     fdt_totalsize(fdt), FDT_MAX_SIZE);
> > 
> > You did adjust indent here...
> > 
> > 
> > >           exit(1);
> > >       }
> > >
> > > @@ -1419,7 +1419,7 @@ static void ppc_spapr_init(MachineState *machine)
> > >       rma_alloc_size = kvmppc_alloc_rma(&rma);
> > >
> > >       if (rma_alloc_size == -1) {
> > > -        hw_error("qemu: Unable to create RMA\n");
> > > +        error_report("Unable to create RMA");
> > >           exit(1);
> > >       }
> > >
> > > @@ -1520,17 +1520,17 @@ static void ppc_spapr_init(MachineState *machine)
> > >
> > >       filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, "spapr-rtas.bin");
> > >       if (!filename) {
> > > -        hw_error("Could not find LPAR rtas '%s'\n", "spapr-rtas.bin");
> > > +        error_report("Could not find LPAR rtas '%s'", "spapr-rtas.bin");
> > >           exit(1);
> > >       }
> > >       spapr->rtas_size = get_image_size(filename);
> > >       spapr->rtas_blob = g_malloc(spapr->rtas_size);
> > >       if (load_image_size(filename, spapr->rtas_blob, spapr->rtas_size) < 0) {
> > > -        hw_error("qemu: could not load LPAR rtas '%s'\n", filename);
> > > +        error_report("Could not load LPAR rtas '%s'", filename);
> > >           exit(1);
> > >       }
> > >       if (spapr->rtas_size > RTAS_MAX_SIZE) {
> > > -        hw_error("RTAS too big ! 0x%zx bytes (max is 0x%x)\n",
> > > +        error_report("RTAS too big ! 0x%zx bytes (max is 0x%x)",
> > >                    (size_t)spapr->rtas_size, RTAS_MAX_SIZE);
> > 
> > ... but not here :)
> 
> Alexey, you're right, of course.
> 
> David, since you already picked up that patch, could you maybe amend
> this cosmetic cleanup to my patch? Or shall I send a new version of the
> patch or a fixup patch?

Amended, thanks.
diff mbox

Patch

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 226f029..92b1c0b 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -794,8 +794,8 @@  static void spapr_finalize_fdt(sPAPREnvironment *spapr,
     _FDT((fdt_pack(fdt)));
 
     if (fdt_totalsize(fdt) > FDT_MAX_SIZE) {
-        hw_error("FDT too big ! 0x%x bytes (max is 0x%x)\n",
-                 fdt_totalsize(fdt), FDT_MAX_SIZE);
+        error_report("FDT too big ! 0x%x bytes (max is 0x%x)",
+                     fdt_totalsize(fdt), FDT_MAX_SIZE);
         exit(1);
     }
 
@@ -1419,7 +1419,7 @@  static void ppc_spapr_init(MachineState *machine)
     rma_alloc_size = kvmppc_alloc_rma(&rma);
 
     if (rma_alloc_size == -1) {
-        hw_error("qemu: Unable to create RMA\n");
+        error_report("Unable to create RMA");
         exit(1);
     }
 
@@ -1520,17 +1520,17 @@  static void ppc_spapr_init(MachineState *machine)
 
     filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, "spapr-rtas.bin");
     if (!filename) {
-        hw_error("Could not find LPAR rtas '%s'\n", "spapr-rtas.bin");
+        error_report("Could not find LPAR rtas '%s'", "spapr-rtas.bin");
         exit(1);
     }
     spapr->rtas_size = get_image_size(filename);
     spapr->rtas_blob = g_malloc(spapr->rtas_size);
     if (load_image_size(filename, spapr->rtas_blob, spapr->rtas_size) < 0) {
-        hw_error("qemu: could not load LPAR rtas '%s'\n", filename);
+        error_report("Could not load LPAR rtas '%s'", filename);
         exit(1);
     }
     if (spapr->rtas_size > RTAS_MAX_SIZE) {
-        hw_error("RTAS too big ! 0x%zx bytes (max is 0x%x)\n",
+        error_report("RTAS too big ! 0x%zx bytes (max is 0x%x)",
                  (size_t)spapr->rtas_size, RTAS_MAX_SIZE);
         exit(1);
     }