]> Git Repo - qemu.git/commitdiff
tap: net_tap_fd_init() can't fail, drop dead error handling
authorMarkus Armbruster <[email protected]>
Fri, 15 May 2015 11:58:53 +0000 (13:58 +0200)
committerStefan Hajnoczi <[email protected]>
Wed, 27 May 2015 08:51:05 +0000 (09:51 +0100)
Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Message-id: 1431691143[email protected]
Signed-off-by: Stefan Hajnoczi <[email protected]>
net/tap.c

index 8f06cb738253620503345ba411dee4a2f5cd8702..adb1022517a5b34c71b18dad387c7c97ec0b6a3a 100644 (file)
--- a/net/tap.c
+++ b/net/tap.c
@@ -536,7 +536,6 @@ int net_init_bridge(const NetClientOptions *opts, const char *name,
     /* FIXME error_setg(errp, ...) on failure */
     const NetdevBridgeOptions *bridge;
     const char *helper, *br;
-
     TAPState *s;
     int fd, vnet_hdr;
 
@@ -552,14 +551,8 @@ int net_init_bridge(const NetClientOptions *opts, const char *name,
     }
 
     fcntl(fd, F_SETFL, O_NONBLOCK);
-
     vnet_hdr = tap_probe_vnet_hdr(fd);
-
     s = net_tap_fd_init(peer, "bridge", name, fd, vnet_hdr);
-    if (!s) {
-        close(fd);
-        return -1;
-    }
 
     snprintf(s->nc.info_str, sizeof(s->nc.info_str), "helper=%s,br=%s", helper,
              br);
@@ -607,14 +600,9 @@ static int net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer,
                             int vnet_hdr, int fd)
 {
     Error *err = NULL;
-    TAPState *s;
+    TAPState *s = net_tap_fd_init(peer, model, name, fd, vnet_hdr);
     int vhostfd;
 
-    s = net_tap_fd_init(peer, model, name, fd, vnet_hdr);
-    if (!s) {
-        return -1;
-    }
-
     if (tap_set_sndbuf(s->fd, tap) < 0) {
         return -1;
     }
This page took 0.027841 seconds and 4 git commands to generate.