qemu-trivial
[Top][All Lists]
Advanced

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

[PATCH v1 10/59] chardev/char-win.c: remove 'fail' label in win_chr_seri


From: Daniel Henrique Barboza
Subject: [PATCH v1 10/59] chardev/char-win.c: remove 'fail' label in win_chr_serial_init()
Date: Mon, 6 Jan 2020 15:23:36 -0300

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>
---
 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




reply via email to

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