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

[Xen-devel] [RFC PATCH 14/17] xenconsoled: deduplicate error handling



---
 tools/console/daemon/io.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c
index 7761c60..508bc2c 100644
--- a/tools/console/daemon/io.c
+++ b/tools/console/daemon/io.c
@@ -794,9 +794,7 @@ static int console_create_ring(struct console *con)
 
        if (rc == -1) {
                err = errno;
-               xenevtchn_close(con->xce_handle);
-               con->xce_handle = NULL;
-               goto out;
+               goto err_xce;
        }
        con->local_port = rc;
        con->remote_port = remote_port;
@@ -804,11 +802,7 @@ static int console_create_ring(struct console *con)
        if (con->master_fd == -1) {
                if (!console_create_tty(con)) {
                        err = errno;
-                       xenevtchn_close(con->xce_handle);
-                       con->xce_handle = NULL;
-                       con->local_port = -1;
-                       con->remote_port = -1;
-                       goto out;
+                       goto err_xce;
                }
        }
 
@@ -818,6 +812,13 @@ static int console_create_ring(struct console *con)
        /* if everything ok, signal backend readiness, in backend tree */
        set_backend_state(con, XenbusStateConnected);
 
+ err_xce:
+       if (err) {
+               xenevtchn_close(con->xce_handle);
+               con->xce_handle = NULL;
+               con->local_port = -1;
+               con->remote_port = -1;
+       }
  out:
        return err;
 }
-- 
git-series 0.9.1

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.