Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LusSX-0005io-AS for qemu-devel@nongnu.org; Fri, 17 Apr 2009 14:06:41 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LusSW-0005iB-9G for qemu-devel@nongnu.org; Fri, 17 Apr 2009 14:06:40 -0400 Received: from [199.232.76.173] (port=60734 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LusSW-0005i7-4j for qemu-devel@nongnu.org; Fri, 17 Apr 2009 14:06:40 -0400 Received: from savannah.gnu.org ([199.232.41.3]:34157 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LusSV-0002ii-ML for qemu-devel@nongnu.org; Fri, 17 Apr 2009 14:06:39 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1LusSV-0004IR-66 for qemu-devel@nongnu.org; Fri, 17 Apr 2009 18:06:39 +0000 Received: from aliguori by cvs.savannah.gnu.org with local (Exim 4.69) (envelope-from ) id 1LusSV-0004IN-0G for qemu-devel@nongnu.org; Fri, 17 Apr 2009 18:06:39 +0000 MIME-Version: 1.0 Errors-To: aliguori Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Anthony Liguori Message-Id: Date: Fri, 17 Apr 2009 18:06:39 +0000 Subject: [Qemu-devel] [7156] Remove some useless malloc() checking (Mark McLoughlin) Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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 Signed-off-by: Anthony Liguori 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))