[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 02/23] hw/char/sh_serial: Use hw_error instead of fprintf
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH v4 02/23] hw/char/sh_serial: Use hw_error instead of fprintf and abort |
Date: |
Fri, 29 Oct 2021 07:38:20 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 |
On 10/28/21 21:27, BALATON Zoltan wrote:
> It does the same with dumping some more state but avoids calling abort
> directly and printing to stderr from the device model.
hw_error() is unfortunately misnamed, it is meant for CPU code,
and we want to get ride of it. What you probably want here is
error_report() which also reports to the monitor.
> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
> ---
> hw/char/sh_serial.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/hw/char/sh_serial.c b/hw/char/sh_serial.c
> index 1b1e6a6a04..dbefb51d71 100644
> --- a/hw/char/sh_serial.c
> +++ b/hw/char/sh_serial.c
> @@ -26,6 +26,7 @@
> */
>
> #include "qemu/osdep.h"
> +#include "hw/hw.h"
> #include "hw/irq.h"
> #include "hw/sh4/sh.h"
> #include "chardev/char-fe.h"
> @@ -200,9 +201,7 @@ static void sh_serial_write(void *opaque, hwaddr offs,
> }
> }
>
> - fprintf(stderr, "sh_serial: unsupported write to 0x%02"
> - HWADDR_PRIx "\n", offs);
> - abort();
> + hw_error("sh_serial: unsupported write to 0x%02"HWADDR_PRIx"\n", offs);
> }
>
> static uint64_t sh_serial_read(void *opaque, hwaddr offs,
> @@ -307,9 +306,7 @@ static uint64_t sh_serial_read(void *opaque, hwaddr offs,
> #endif
>
> if (ret & ~((1 << 16) - 1)) {
> - fprintf(stderr, "sh_serial: unsupported read from 0x%02"
> - HWADDR_PRIx "\n", offs);
> - abort();
> + hw_error("sh_serial: unsupported read from 0x%02"HWADDR_PRIx"\n",
> offs);
> }
>
> return ret;
>
- [PATCH v4 00/23] More SH4 clean ups, BALATON Zoltan, 2021/10/28
- [PATCH v4 04/23] hw/sh4/r2d: Use error_report instead of fprintf to stderr, BALATON Zoltan, 2021/10/28
- [PATCH v4 02/23] hw/char/sh_serial: Use hw_error instead of fprintf and abort, BALATON Zoltan, 2021/10/28
- Re: [PATCH v4 02/23] hw/char/sh_serial: Use hw_error instead of fprintf and abort,
Philippe Mathieu-Daudé <=
- [PATCH v4 05/23] hw/char/sh_serial: Rename type sh_serial_state to SHSerialState, BALATON Zoltan, 2021/10/28
- [PATCH v4 01/23] hw/sh4: Fix typos in a comment, BALATON Zoltan, 2021/10/28
- [PATCH v4 07/23] hw/char/sh_serial: Add device id to trace output, BALATON Zoltan, 2021/10/28
- [PATCH v4 08/23] hw/intc/sh_intc: Use existing macro instead of local one, BALATON Zoltan, 2021/10/28
- [PATCH v4 10/23] hw/intc/sh_intc: Rename iomem region, BALATON Zoltan, 2021/10/28
- [PATCH v4 03/23] hw/sh4: Change debug printfs to traces, BALATON Zoltan, 2021/10/28
- [PATCH v4 15/23] hw/intc/sh_intc: Inline and drop sh_intc_source() function, BALATON Zoltan, 2021/10/28