qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [7156] Remove some useless malloc() checking (Mark McLoughl


From: Anthony Liguori
Subject: [Qemu-devel] [7156] Remove some useless malloc() checking (Mark McLoughlin)
Date: Fri, 17 Apr 2009 18:06:39 +0000

Revision: 7156
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=7156
Author:   aliguori
Date:     2009-04-17 18:06:38 +0000 (Fri, 17 Apr 2009)
Log Message:
-----------
Remove some useless malloc() checking (Mark McLoughlin)

Now that we abort() on malloc, neither qemu_find_vlan() nor
net_tap_fd_init() can fail.

Signed-off-by: Mark McLoughlin <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>

Modified Paths:
--------------
    branches/stable_0_10/net.c

Modified: branches/stable_0_10/net.c
===================================================================
--- branches/stable_0_10/net.c  2009-04-17 18:06:34 UTC (rev 7155)
+++ branches/stable_0_10/net.c  2009-04-17 18:06:38 UTC (rev 7156)
@@ -1011,8 +1011,6 @@
            return -1;
     }
     s = net_tap_fd_init(vlan, model, name, fd);
-    if (!s)
-        return -1;
     snprintf(s->vc->info_str, sizeof(s->vc->info_str),
              "ifname=%s,script=%s,downscript=%s",
              ifname, setup_script, down_script);
@@ -1592,10 +1590,7 @@
         vlan_id = strtol(buf, NULL, 0);
     }
     vlan = qemu_find_vlan(vlan_id);
-    if (!vlan) {
-        fprintf(stderr, "Could not create vlan %d\n", vlan_id);
-        return -1;
-    }
+
     if (get_param_value(buf, sizeof(buf), "name", p)) {
         name = strdup(buf);
     }
@@ -1703,9 +1698,8 @@
         if (get_param_value(buf, sizeof(buf), "fd", p) > 0) {
             fd = strtol(buf, NULL, 0);
             fcntl(fd, F_SETFL, O_NONBLOCK);
-            ret = -1;
-            if (net_tap_fd_init(vlan, device, name, fd))
-                ret = 0;
+            net_tap_fd_init(vlan, device, name, fd);
+            ret = 0;
         } else {
             if (get_param_value(ifname, sizeof(ifname), "ifname", p) <= 0) {
                 ifname[0] = '\0';
@@ -1821,10 +1815,6 @@
     VLANClientState *vc;
 
     vlan = qemu_find_vlan(vlan_id);
-    if (!vlan) {
-        term_printf("can't find vlan %d\n", vlan_id);
-        return;
-    }
 
    for(vc = vlan->first_client; vc != NULL; vc = vc->next)
         if (!strcmp(vc->name, device))





reply via email to

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