From: aliguori Date: Fri, 17 Apr 2009 18:06:38 +0000 (+0000) Subject: Remove some useless malloc() checking (Mark McLoughlin) X-Git-Tag: v0.10.3~22 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=eb5951f33352b8e5c0f3e3a0438ba57a35f1da31;p=thirdparty%2Fqemu.git 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 Signed-off-by: Anthony Liguori git-svn-id: svn://svn.savannah.nongnu.org/qemu/branches/stable_0_10@7156 c046a42c-6fe2-441c-8c8c-71466251a162 --- diff --git a/net.c b/net.c index 4a16658486a..9279c1cc2d1 100644 --- a/net.c +++ b/net.c @@ -1011,8 +1011,6 @@ static int net_tap_init(VLANState *vlan, const char *model, 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 @@ int net_client_init(const char *device, const char *p) 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 @@ int net_client_init(const char *device, const char *p) 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 @@ void net_host_device_remove(int vlan_id, const char *device) 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))