qemu-trivial
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v1 09/59] chardev/char-pipe.c: remove 'fail' label in win_chr


From: Marc-André Lureau
Subject: Re: [PATCH v1 09/59] chardev/char-pipe.c: remove 'fail' label in win_chr_pipe_init()
Date: Mon, 6 Jan 2020 23:01:31 +0400

On Mon, Jan 6, 2020 at 10:25 PM Daniel Henrique Barboza
<address@hidden> wrote:
>
> The 'fail' label is simply doing a 'return -1'.
>
> 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-pipe.c | 13 +++++--------
>  1 file changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/chardev/char-pipe.c b/chardev/char-pipe.c
> index 94d714ffcd..65d52beb0d 100644
> --- a/chardev/char-pipe.c
> +++ b/chardev/char-pipe.c
> @@ -54,12 +54,12 @@ static int win_chr_pipe_init(Chardev *chr, const char 
> *filename,
>      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;
>      }
>
>      openname = g_strdup_printf("\\\\.\\pipe\\%s", filename);
> @@ -72,7 +72,7 @@ static int win_chr_pipe_init(Chardev *chr, const char 
> *filename,
>      if (s->file == INVALID_HANDLE_VALUE) {
>          error_setg(errp, "Failed CreateNamedPipe (%lu)", GetLastError());
>          s->file = NULL;
> -        goto fail;
> +        return -1;
>      }
>
>      ZeroMemory(&ov, sizeof(ov));
> @@ -80,7 +80,7 @@ static int win_chr_pipe_init(Chardev *chr, const char 
> *filename,
>      ret = ConnectNamedPipe(s->file, &ov);
>      if (ret) {
>          error_setg(errp, "Failed ConnectNamedPipe");
> -        goto fail;
> +        return -1;
>      }
>
>      ret = GetOverlappedResult(s->file, &ov, &size, TRUE);
> @@ -90,7 +90,7 @@ static int win_chr_pipe_init(Chardev *chr, const char 
> *filename,
>              CloseHandle(ov.hEvent);
>              ov.hEvent = NULL;
>          }
> -        goto fail;
> +        return -1;
>      }
>
>      if (ov.hEvent) {
> @@ -99,9 +99,6 @@ static int win_chr_pipe_init(Chardev *chr, const char 
> *filename,
>      }
>      qemu_add_polling_cb(win_chr_pipe_poll, chr);
>      return 0;
> -
> - fail:
> -    return -1;
>  }
>
>  static void qemu_chr_open_pipe(Chardev *chr,
> --
> 2.24.1
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]