[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v1 10/59] chardev/char-win.c: remove 'fail' label in win_chr_
From: |
Marc-André Lureau |
Subject: |
Re: [PATCH v1 10/59] chardev/char-win.c: remove 'fail' label in win_chr_serial_init() |
Date: |
Mon, 6 Jan 2020 23:01:06 +0400 |
On Mon, Jan 6, 2020 at 10:25 PM Daniel Henrique Barboza
<address@hidden> wrote:
>
> The 'fail' label is a simply call to 'return -1' on error. Remove
> it and do the return call instead.
>
> CC: Marc-André Lureau <address@hidden>
> CC: Paolo Bonzini <address@hidden>
> Signed-off-by: Daniel Henrique Barboza <address@hidden>
Reviewed-by: Marc-André Lureau <address@hidden>
> ---
> chardev/char-win.c | 19 ++++++++-----------
> 1 file changed, 8 insertions(+), 11 deletions(-)
>
> diff --git a/chardev/char-win.c b/chardev/char-win.c
> index 34825f683d..72c232e6d9 100644
> --- a/chardev/char-win.c
> +++ b/chardev/char-win.c
> @@ -85,12 +85,12 @@ int win_chr_serial_init(Chardev *chr, const char
> *filename, Error **errp)
> s->hsend = CreateEvent(NULL, TRUE, FALSE, NULL);
> if (!s->hsend) {
> error_setg(errp, "Failed CreateEvent");
> - goto fail;
> + return -1;
> }
> s->hrecv = CreateEvent(NULL, TRUE, FALSE, NULL);
> if (!s->hrecv) {
> error_setg(errp, "Failed CreateEvent");
> - goto fail;
> + return -1;
> }
>
> s->file = CreateFile(filename, GENERIC_READ | GENERIC_WRITE, 0, NULL,
> @@ -98,12 +98,12 @@ int win_chr_serial_init(Chardev *chr, const char
> *filename, Error **errp)
> if (s->file == INVALID_HANDLE_VALUE) {
> error_setg(errp, "Failed CreateFile (%lu)", GetLastError());
> s->file = NULL;
> - goto fail;
> + return -1;
> }
>
> if (!SetupComm(s->file, NRECVBUF, NSENDBUF)) {
> error_setg(errp, "Failed SetupComm");
> - goto fail;
> + return -1;
> }
>
> ZeroMemory(&comcfg, sizeof(COMMCONFIG));
> @@ -114,29 +114,26 @@ int win_chr_serial_init(Chardev *chr, const char
> *filename, Error **errp)
>
> if (!SetCommState(s->file, &comcfg.dcb)) {
> error_setg(errp, "Failed SetCommState");
> - goto fail;
> + return -1;
> }
>
> if (!SetCommMask(s->file, EV_ERR)) {
> error_setg(errp, "Failed SetCommMask");
> - goto fail;
> + return -1;
> }
>
> cto.ReadIntervalTimeout = MAXDWORD;
> if (!SetCommTimeouts(s->file, &cto)) {
> error_setg(errp, "Failed SetCommTimeouts");
> - goto fail;
> + return -1;
> }
>
> if (!ClearCommError(s->file, &err, &comstat)) {
> error_setg(errp, "Failed ClearCommError");
> - goto fail;
> + return -1;
> }
> qemu_add_polling_cb(win_chr_serial_poll, chr);
> return 0;
> -
> - fail:
> - return -1;
> }
>
> int win_chr_pipe_poll(void *opaque)
> --
> 2.24.1
>
- [PATCH v1 03/59] kvm-all.c: remove unneeded labels, (continued)
- [PATCH v1 03/59] kvm-all.c: remove unneeded labels, Daniel Henrique Barboza, 2020/01/06
- [PATCH v1 01/59] spapr.c: remove 'out' label in spapr_dt_cas_updates(), Daniel Henrique Barboza, 2020/01/06
- [PATCH v1 02/59] ppc440_bamboo.c: remove label from bamboo_load_device_tree(), Daniel Henrique Barboza, 2020/01/06
- [PATCH v1 04/59] paaudio.c: remove unneeded labels, Daniel Henrique Barboza, 2020/01/06
- [PATCH v1 07/59] unicore32/softmmu.c: remove 'do_fault' label in get_phys_addr_ucv2(), Daniel Henrique Barboza, 2020/01/06
- [PATCH v1 08/59] chardev/char-mux.c: remove 'send_char' label, Daniel Henrique Barboza, 2020/01/06
- [PATCH v1 10/59] chardev/char-win.c: remove 'fail' label in win_chr_serial_init(), Daniel Henrique Barboza, 2020/01/06
- [PATCH v1 11/59] exec.c: remove 'err' label in ram_block_discard_range(), Daniel Henrique Barboza, 2020/01/06
- [PATCH v1 12/59] virtfs-proxy-helper.c: remove 'err_out' label in setugid(), Daniel Henrique Barboza, 2020/01/06
[PATCH v1 13/59] block/vdi.c: remove 'fail' label in vdi_open(), Daniel Henrique Barboza, 2020/01/06