toplevel: remove error handling from qemu_malloc() callers (Avi Kivity)
[qemu] / usb-linux.c
index fb1153b..f19f0c4 100644 (file)
@@ -441,10 +441,6 @@ static int usb_host_handle_data(USBHostDevice *s, USBPacket *p)
     int ret;
 
     aurb = async_alloc();
-    if (!aurb) {
-        dprintf("husb: async malloc failed\n");
-        return USB_RET_NAK;
-    }
     aurb->hdev   = s;
     aurb->packet = p;
 
@@ -585,10 +581,6 @@ static int usb_host_handle_control(USBHostDevice *s, USBPacket *p)
     /* The rest are asynchronous */
 
     aurb = async_alloc();
-    if (!aurb) {
-        dprintf("husb: async malloc failed\n");
-        return USB_RET_NAK;
-    }
     aurb->hdev   = s;
     aurb->packet = p;
 
@@ -898,8 +890,6 @@ static USBDevice *usb_host_device_open_addr(int bus_num, int addr, const char *p
     char buf[1024];
 
     dev = qemu_mallocz(sizeof(USBHostDevice));
-    if (!dev)
-        goto fail;
 
     dev->bus_num = bus_num;
     dev->addr = addr;
@@ -1308,14 +1298,8 @@ static int usb_host_scan(void *opaque, USBScanFunc *func)
 
         /* the module setting (used later for opening devices) */
         usb_host_device_path = qemu_mallocz(strlen(devpath)+1);
-        if (usb_host_device_path) {
-            strcpy(usb_host_device_path, devpath);
-            term_printf("husb: using %s file-system with %s\n", fs_type[usb_fs_type], usb_host_device_path);
-        } else {
-            /* out of memory? */
-            perror("husb: unable to allocate memory for device path");
-            return -ENOMEM;
-        }
+        strcpy(usb_host_device_path, devpath);
+        term_printf("husb: using %s file-system with %s\n", fs_type[usb_fs_type], usb_host_device_path);
     }
 
     switch (usb_fs_type) {
@@ -1455,10 +1439,6 @@ static int usb_host_auto_add(const char *spec)
         return -1;
 
     f = qemu_mallocz(sizeof(*f));
-    if (!f) {
-        fprintf(stderr, "husb: failed to allocate auto filter\n");
-        return -1;
-    }
 
     *f = filter;