summaryrefslogtreecommitdiff
path: root/net.c
diff options
context:
space:
mode:
authoraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2009-04-17 17:10:51 +0000
committeraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2009-04-17 17:10:51 +0000
commit9036de1a8ad6c565a4e5d8cd124ad8dd05e7d4d4 (patch)
tree21115ab926ca739631a34b4afb20676db871d9ba /net.c
parenteefb4091d29d8a32f02e004d50028201926d23f0 (diff)
downloadqemu-9036de1a8ad6c565a4e5d8cd124ad8dd05e7d4d4.tar.gz
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 <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7146 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'net.c')
-rw-r--r--net.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/net.c b/net.c
index 2383b10ac9..34ec4c810b 100644
--- a/net.c
+++ b/net.c
@@ -1015,8 +1015,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);
@@ -1596,10 +1594,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);
}
@@ -1707,9 +1702,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';
@@ -1825,10 +1819,6 @@ void net_host_device_remove(Monitor *mon, int vlan_id, const char *device)
VLANClientState *vc;
vlan = qemu_find_vlan(vlan_id);
- if (!vlan) {
- monitor_printf(mon, "can't find vlan %d\n", vlan_id);
- return;
- }
for(vc = vlan->first_client; vc != NULL; vc = vc->next)
if (!strcmp(vc->name, device))