Merge tag 'usb-4.8-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb

Pull USB fixes from Greg KH:
"Here are a number of USB fixes for reported issues for your tree.

The normal amount of gadget fixes, xhci fixes, new device ids, and a
few other minor things. All of them have been in linux-next for a
while, the full details are in the shortlog below"

* tag 'usb-4.8-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (43 commits)
xhci: don't dereference a xhci member after removing xhci
usb: xhci: Fix panic if disconnect
xhci: really enqueue zero length TRBs.
xhci: always handle "Command Ring Stopped" events
cdc-acm: fix wrong pipe type on rx interrupt xfers
usb: misc: usbtest: add fix for driver hang
usb: dwc3: gadget: stop processing on HWO set
usb: dwc3: don't set last bit for ISOC endpoints
usb: gadget: rndis: free response queue during REMOTE_NDIS_RESET_MSG
usb: udc: core: fix error handling
usb: gadget: fsl_qe_udc: off by one in setup_received_handle()
usb/gadget: fix gadgetfs aio support.
usb: gadget: composite: Fix return value in case of error
usb: gadget: uvc: Fix return value in case of error
usb: gadget: fix check in sync read from ep in gadgetfs
usb: misc: usbtest: usbtest_do_ioctl may return positive integer
usb: dwc3: fix missing platform_set_drvdata() in dwc3_of_simple_probe()
usb: phy: omap-otg: Fix missing platform_set_drvdata() in omap_otg_probe()
usb: gadget: configfs: add mutex lock before unregister gadget
usb: gadget: u_ether: fix dereference after null check coverify warning
...

+2 -3
drivers/usb/class/cdc-acm.c
··· 1354 1354 spin_lock_init(&acm->write_lock); 1355 1355 spin_lock_init(&acm->read_lock); 1356 1356 mutex_init(&acm->mutex); 1357 - acm->rx_endpoint = usb_rcvbulkpipe(usb_dev, epread->bEndpointAddress); 1358 1357 acm->is_int_ep = usb_endpoint_xfer_int(epread); 1359 1358 if (acm->is_int_ep) 1360 1359 acm->bInterval = epread->bInterval; ··· 1393 1394 urb->transfer_dma = rb->dma; 1394 1395 if (acm->is_int_ep) { 1395 1396 usb_fill_int_urb(urb, acm->dev, 1396 - acm->rx_endpoint, 1397 + usb_rcvintpipe(usb_dev, epread->bEndpointAddress), 1397 1398 rb->base, 1398 1399 acm->readsize, 1399 1400 acm_read_bulk_callback, rb, 1400 1401 acm->bInterval); 1401 1402 } else { 1402 1403 usb_fill_bulk_urb(urb, acm->dev, 1403 - acm->rx_endpoint, 1404 + usb_rcvbulkpipe(usb_dev, epread->bEndpointAddress), 1404 1405 rb->base, 1405 1406 acm->readsize, 1406 1407 acm_read_bulk_callback, rb);
-1
drivers/usb/class/cdc-acm.h
··· 96 96 struct acm_rb read_buffers[ACM_NR]; 97 97 struct acm_wb *putbuffer; /* for acm_tty_put_char() */ 98 98 int rx_buflimit; 99 - int rx_endpoint; 100 99 spinlock_t read_lock; 101 100 int write_used; /* number of non-empty write buffers */ 102 101 int transmitting;
+63 -3
drivers/usb/core/config.c
··· 171 171 ep, buffer, size); 172 172 } 173 173 174 + static const unsigned short low_speed_maxpacket_maxes[4] = { 175 + [USB_ENDPOINT_XFER_CONTROL] = 8, 176 + [USB_ENDPOINT_XFER_ISOC] = 0, 177 + [USB_ENDPOINT_XFER_BULK] = 0, 178 + [USB_ENDPOINT_XFER_INT] = 8, 179 + }; 180 + static const unsigned short full_speed_maxpacket_maxes[4] = { 181 + [USB_ENDPOINT_XFER_CONTROL] = 64, 182 + [USB_ENDPOINT_XFER_ISOC] = 1023, 183 + [USB_ENDPOINT_XFER_BULK] = 64, 184 + [USB_ENDPOINT_XFER_INT] = 64, 185 + }; 186 + static const unsigned short high_speed_maxpacket_maxes[4] = { 187 + [USB_ENDPOINT_XFER_CONTROL] = 64, 188 + [USB_ENDPOINT_XFER_ISOC] = 1024, 189 + [USB_ENDPOINT_XFER_BULK] = 512, 190 + [USB_ENDPOINT_XFER_INT] = 1023, 191 + }; 192 + static const unsigned short super_speed_maxpacket_maxes[4] = { 193 + [USB_ENDPOINT_XFER_CONTROL] = 512, 194 + [USB_ENDPOINT_XFER_ISOC] = 1024, 195 + [USB_ENDPOINT_XFER_BULK] = 1024, 196 + [USB_ENDPOINT_XFER_INT] = 1024, 197 + }; 198 + 174 199 static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum, 175 200 int asnum, struct usb_host_interface *ifp, int num_ep, 176 201 unsigned char *buffer, int size) ··· 204 179 struct usb_endpoint_descriptor *d; 205 180 struct usb_host_endpoint *endpoint; 206 181 int n, i, j, retval; 182 + unsigned int maxp; 183 + const unsigned short *maxpacket_maxes; 207 184 208 185 d = (struct usb_endpoint_descriptor *) buffer; 209 186 buffer += d->bLength; ··· 313 286 endpoint->desc.wMaxPacketSize = cpu_to_le16(8); 314 287 } 315 288 289 + /* Validate the wMaxPacketSize field */ 290 + maxp = usb_endpoint_maxp(&endpoint->desc); 291 + 292 + /* Find the highest legal maxpacket size for this endpoint */ 293 + i = 0; /* additional transactions per microframe */ 294 + switch (to_usb_device(ddev)->speed) { 295 + case USB_SPEED_LOW: 296 + maxpacket_maxes = low_speed_maxpacket_maxes; 297 + break; 298 + case USB_SPEED_FULL: 299 + maxpacket_maxes = full_speed_maxpacket_maxes; 300 + break; 301 + case USB_SPEED_HIGH: 302 + /* Bits 12..11 are allowed only for HS periodic endpoints */ 303 + if (usb_endpoint_xfer_int(d) || usb_endpoint_xfer_isoc(d)) { 304 + i = maxp & (BIT(12) | BIT(11)); 305 + maxp &= ~i; 306 + } 307 + /* fallthrough */ 308 + default: 309 + maxpacket_maxes = high_speed_maxpacket_maxes; 310 + break; 311 + case USB_SPEED_SUPER: 312 + case USB_SPEED_SUPER_PLUS: 313 + maxpacket_maxes = super_speed_maxpacket_maxes; 314 + break; 315 + } 316 + j = maxpacket_maxes[usb_endpoint_type(&endpoint->desc)]; 317 + 318 + if (maxp > j) { 319 + dev_warn(ddev, "config %d interface %d altsetting %d endpoint 0x%X has invalid maxpacket %d, setting to %d\n", 320 + cfgno, inum, asnum, d->bEndpointAddress, maxp, j); 321 + maxp = j; 322 + endpoint->desc.wMaxPacketSize = cpu_to_le16(i | maxp); 323 + } 324 + 316 325 /* 317 326 * Some buggy high speed devices have bulk endpoints using 318 327 * maxpacket sizes other than 512. High speed HCDs may not ··· 356 293 */ 357 294 if (to_usb_device(ddev)->speed == USB_SPEED_HIGH 358 295 && usb_endpoint_xfer_bulk(d)) { 359 - unsigned maxp; 360 - 361 - maxp = usb_endpoint_maxp(&endpoint->desc) & 0x07ff; 362 296 if (maxp != 512) 363 297 dev_warn(ddev, "config %d interface %d altsetting %d " 364 298 "bulk endpoint 0x%X has invalid maxpacket %d\n",
+5 -2
drivers/usb/core/devio.c
··· 241 241 goto error_decrease_mem; 242 242 } 243 243 244 - mem = usb_alloc_coherent(ps->dev, size, GFP_USER, &dma_handle); 244 + mem = usb_alloc_coherent(ps->dev, size, GFP_USER | __GFP_NOWARN, 245 + &dma_handle); 245 246 if (!mem) { 246 247 ret = -ENOMEM; 247 248 goto error_free_usbm; ··· 2583 2582 if (file->f_mode & FMODE_WRITE && !list_empty(&ps->async_completed)) 2584 2583 mask |= POLLOUT | POLLWRNORM; 2585 2584 if (!connected(ps)) 2586 - mask |= POLLERR | POLLHUP; 2585 + mask |= POLLHUP; 2586 + if (list_empty(&ps->list)) 2587 + mask |= POLLERR; 2587 2588 return mask; 2588 2589 } 2589 2590
+9 -14
drivers/usb/core/hub.c
··· 1052 1052 1053 1053 /* Continue a partial initialization */ 1054 1054 if (type == HUB_INIT2 || type == HUB_INIT3) { 1055 - device_lock(hub->intfdev); 1055 + device_lock(&hdev->dev); 1056 1056 1057 1057 /* Was the hub disconnected while we were waiting? */ 1058 - if (hub->disconnected) { 1059 - device_unlock(hub->intfdev); 1060 - kref_put(&hub->kref, hub_release); 1061 - return; 1062 - } 1058 + if (hub->disconnected) 1059 + goto disconnected; 1063 1060 if (type == HUB_INIT2) 1064 1061 goto init2; 1065 1062 goto init3; ··· 1259 1262 queue_delayed_work(system_power_efficient_wq, 1260 1263 &hub->init_work, 1261 1264 msecs_to_jiffies(delay)); 1262 - device_unlock(hub->intfdev); 1265 + device_unlock(&hdev->dev); 1263 1266 return; /* Continues at init3: below */ 1264 1267 } else { 1265 1268 msleep(delay); ··· 1278 1281 /* Scan all ports that need attention */ 1279 1282 kick_hub_wq(hub); 1280 1283 1281 - /* Allow autosuspend if it was suppressed */ 1282 - if (type <= HUB_INIT3) 1284 + if (type == HUB_INIT2 || type == HUB_INIT3) { 1285 + /* Allow autosuspend if it was suppressed */ 1286 + disconnected: 1283 1287 usb_autopm_put_interface_async(to_usb_interface(hub->intfdev)); 1284 - 1285 - if (type == HUB_INIT2 || type == HUB_INIT3) 1286 - device_unlock(hub->intfdev); 1288 + device_unlock(&hdev->dev); 1289 + } 1287 1290 1288 1291 kref_put(&hub->kref, hub_release); 1289 1292 } ··· 1311 1314 { 1312 1315 struct usb_device *hdev = hub->hdev; 1313 1316 int i; 1314 - 1315 - cancel_delayed_work_sync(&hub->init_work); 1316 1317 1317 1318 /* hub_wq and related activity won't re-trigger */ 1318 1319 hub->quiescing = 1;
+1
drivers/usb/dwc3/dwc3-of-simple.c
··· 61 61 if (!simple->clks) 62 62 return -ENOMEM; 63 63 64 + platform_set_drvdata(pdev, simple); 64 65 simple->dev = dev; 65 66 66 67 for (i = 0; i < simple->num_clocks; i++) {
+2
drivers/usb/dwc3/dwc3-pci.c
··· 37 37 #define PCI_DEVICE_ID_INTEL_BXT 0x0aaa 38 38 #define PCI_DEVICE_ID_INTEL_BXT_M 0x1aaa 39 39 #define PCI_DEVICE_ID_INTEL_APL 0x5aaa 40 + #define PCI_DEVICE_ID_INTEL_KBP 0xa2b0 40 41 41 42 static const struct acpi_gpio_params reset_gpios = { 0, 0, false }; 42 43 static const struct acpi_gpio_params cs_gpios = { 1, 0, false }; ··· 228 227 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BXT), }, 229 228 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BXT_M), }, 230 229 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_APL), }, 230 + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_KBP), }, 231 231 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB), }, 232 232 { } /* Terminating Entry */ 233 233 };
+33 -22
drivers/usb/dwc3/gadget.c
··· 829 829 if (!req->request.no_interrupt && !chain) 830 830 trb->ctrl |= DWC3_TRB_CTRL_IOC | DWC3_TRB_CTRL_ISP_IMI; 831 831 832 - if (last) 832 + if (last && !usb_endpoint_xfer_isoc(dep->endpoint.desc)) 833 833 trb->ctrl |= DWC3_TRB_CTRL_LST; 834 834 835 835 if (chain) ··· 1955 1955 1956 1956 static int __dwc3_cleanup_done_trbs(struct dwc3 *dwc, struct dwc3_ep *dep, 1957 1957 struct dwc3_request *req, struct dwc3_trb *trb, 1958 - const struct dwc3_event_depevt *event, int status) 1958 + const struct dwc3_event_depevt *event, int status, 1959 + int chain) 1959 1960 { 1960 1961 unsigned int count; 1961 1962 unsigned int s_pkt = 0; ··· 1965 1964 dep->queued_requests--; 1966 1965 trace_dwc3_complete_trb(dep, trb); 1967 1966 1967 + /* 1968 + * If we're in the middle of series of chained TRBs and we 1969 + * receive a short transfer along the way, DWC3 will skip 1970 + * through all TRBs including the last TRB in the chain (the 1971 + * where CHN bit is zero. DWC3 will also avoid clearing HWO 1972 + * bit and SW has to do it manually. 1973 + * 1974 + * We're going to do that here to avoid problems of HW trying 1975 + * to use bogus TRBs for transfers. 1976 + */ 1977 + if (chain && (trb->ctrl & DWC3_TRB_CTRL_HWO)) 1978 + trb->ctrl &= ~DWC3_TRB_CTRL_HWO; 1979 + 1968 1980 if ((trb->ctrl & DWC3_TRB_CTRL_HWO) && status != -ESHUTDOWN) 1969 - /* 1970 - * We continue despite the error. There is not much we 1971 - * can do. If we don't clean it up we loop forever. If 1972 - * we skip the TRB then it gets overwritten after a 1973 - * while since we use them in a ring buffer. A BUG() 1974 - * would help. Lets hope that if this occurs, someone 1975 - * fixes the root cause instead of looking away :) 1976 - */ 1977 - dev_err(dwc->dev, "%s's TRB (%p) still owned by HW\n", 1978 - dep->name, trb); 1981 + return 1; 1982 + 1979 1983 count = trb->size & DWC3_TRB_SIZE_MASK; 1980 1984 1981 1985 if (dep->direction) { ··· 2019 2013 s_pkt = 1; 2020 2014 } 2021 2015 2022 - /* 2023 - * We assume here we will always receive the entire data block 2024 - * which we should receive. Meaning, if we program RX to 2025 - * receive 4K but we receive only 2K, we assume that's all we 2026 - * should receive and we simply bounce the request back to the 2027 - * gadget driver for further processing. 2028 - */ 2029 - req->request.actual += req->request.length - count; 2030 - if (s_pkt) 2016 + if (s_pkt && !chain) 2031 2017 return 1; 2032 2018 if ((event->status & DEPEVT_STATUS_LST) && 2033 2019 (trb->ctrl & (DWC3_TRB_CTRL_LST | ··· 2038 2040 struct dwc3_trb *trb; 2039 2041 unsigned int slot; 2040 2042 unsigned int i; 2043 + int count = 0; 2041 2044 int ret; 2042 2045 2043 2046 do { 2047 + int chain; 2048 + 2044 2049 req = next_request(&dep->started_list); 2045 2050 if (WARN_ON_ONCE(!req)) 2046 2051 return 1; 2047 2052 2053 + chain = req->request.num_mapped_sgs > 0; 2048 2054 i = 0; 2049 2055 do { 2050 2056 slot = req->first_trb_index + i; ··· 2056 2054 slot++; 2057 2055 slot %= DWC3_TRB_NUM; 2058 2056 trb = &dep->trb_pool[slot]; 2057 + count += trb->size & DWC3_TRB_SIZE_MASK; 2059 2058 2060 2059 ret = __dwc3_cleanup_done_trbs(dwc, dep, req, trb, 2061 - event, status); 2060 + event, status, chain); 2062 2061 if (ret) 2063 2062 break; 2064 2063 } while (++i < req->request.num_mapped_sgs); 2065 2064 2065 + /* 2066 + * We assume here we will always receive the entire data block 2067 + * which we should receive. Meaning, if we program RX to 2068 + * receive 4K but we receive only 2K, we assume that's all we 2069 + * should receive and we simply bounce the request back to the 2070 + * gadget driver for further processing. 2071 + */ 2072 + req->request.actual += req->request.length - count; 2066 2073 dwc3_gadget_giveback(dep, req, status); 2067 2074 2068 2075 if (ret)
+4 -2
drivers/usb/gadget/composite.c
··· 1913 1913 break; 1914 1914 1915 1915 case USB_RECIP_ENDPOINT: 1916 + if (!cdev->config) 1917 + break; 1916 1918 endp = ((w_index & 0x80) >> 3) | (w_index & 0x0f); 1917 1919 list_for_each_entry(f, &cdev->config->functions, list) { 1918 1920 if (test_bit(endp, f->endpoints)) ··· 2126 2124 2127 2125 cdev->os_desc_req = usb_ep_alloc_request(ep0, GFP_KERNEL); 2128 2126 if (!cdev->os_desc_req) { 2129 - ret = PTR_ERR(cdev->os_desc_req); 2127 + ret = -ENOMEM; 2130 2128 goto end; 2131 2129 } 2132 2130 2133 2131 /* OS feature descriptor length <= 4kB */ 2134 2132 cdev->os_desc_req->buf = kmalloc(4096, GFP_KERNEL); 2135 2133 if (!cdev->os_desc_req->buf) { 2136 - ret = PTR_ERR(cdev->os_desc_req->buf); 2134 + ret = -ENOMEM; 2137 2135 kfree(cdev->os_desc_req); 2138 2136 goto end; 2139 2137 }
+2
drivers/usb/gadget/configfs.c
··· 1490 1490 { 1491 1491 struct gadget_info *gi = to_gadget_info(item); 1492 1492 1493 + mutex_lock(&gi->lock); 1493 1494 unregister_gadget(gi); 1495 + mutex_unlock(&gi->lock); 1494 1496 } 1495 1497 EXPORT_SYMBOL_GPL(unregister_gadget_item); 1496 1498
+6
drivers/usb/gadget/function/rndis.c
··· 680 680 { 681 681 rndis_reset_cmplt_type *resp; 682 682 rndis_resp_t *r; 683 + u8 *xbuf; 684 + u32 length; 685 + 686 + /* drain the response queue */ 687 + while ((xbuf = rndis_get_next_response(params, &length))) 688 + rndis_free_response(params, xbuf); 683 689 684 690 r = rndis_add_response(params, sizeof(rndis_reset_cmplt_type)); 685 691 if (!r)
+2 -1
drivers/usb/gadget/function/u_ether.c
··· 556 556 /* Multi frame CDC protocols may store the frame for 557 557 * later which is not a dropped frame. 558 558 */ 559 - if (dev->port_usb->supports_multi_frame) 559 + if (dev->port_usb && 560 + dev->port_usb->supports_multi_frame) 560 561 goto multiframe; 561 562 goto drop; 562 563 }
+1 -1
drivers/usb/gadget/function/uvc_configfs.c
··· 2023 2023 if (!data) { 2024 2024 kfree(*class_array); 2025 2025 *class_array = NULL; 2026 - ret = PTR_ERR(data); 2026 + ret = -ENOMEM; 2027 2027 goto unlock; 2028 2028 } 2029 2029 cl_arr = *class_array;
+2 -2
drivers/usb/gadget/legacy/inode.c
··· 542 542 */ 543 543 spin_lock_irq(&epdata->dev->lock); 544 544 value = -ENODEV; 545 - if (unlikely(epdata->ep)) 545 + if (unlikely(epdata->ep == NULL)) 546 546 goto fail; 547 547 548 548 req = usb_ep_alloc_request(epdata->ep, GFP_ATOMIC); ··· 606 606 } 607 607 if (is_sync_kiocb(iocb)) { 608 608 value = ep_io(epdata, buf, len); 609 - if (value >= 0 && copy_to_iter(buf, value, to)) 609 + if (value >= 0 && (copy_to_iter(buf, value, to) != value)) 610 610 value = -EFAULT; 611 611 } else { 612 612 struct kiocb_priv *priv = kzalloc(sizeof *priv, GFP_KERNEL);
+4 -1
drivers/usb/gadget/udc/core.c
··· 1145 1145 if (ret != -EPROBE_DEFER) 1146 1146 list_del(&driver->pending); 1147 1147 if (ret) 1148 - goto err4; 1148 + goto err5; 1149 1149 break; 1150 1150 } 1151 1151 } ··· 1153 1153 mutex_unlock(&udc_lock); 1154 1154 1155 1155 return 0; 1156 + 1157 + err5: 1158 + device_del(&udc->dev); 1156 1159 1157 1160 err4: 1158 1161 list_del(&udc->list);
+1 -1
drivers/usb/gadget/udc/fsl_qe_udc.c
··· 2053 2053 struct qe_ep *ep; 2054 2054 2055 2055 if (wValue != 0 || wLength != 0 2056 - || pipe > USB_MAX_ENDPOINTS) 2056 + || pipe >= USB_MAX_ENDPOINTS) 2057 2057 break; 2058 2058 ep = &udc->eps[pipe]; 2059 2059
+2 -2
drivers/usb/host/ehci-hcd.c
··· 332 332 int port = HCS_N_PORTS(ehci->hcs_params); 333 333 334 334 while (port--) { 335 - ehci_writel(ehci, PORT_RWC_BITS, 336 - &ehci->regs->port_status[port]); 337 335 spin_unlock_irq(&ehci->lock); 338 336 ehci_port_power(ehci, port, false); 339 337 spin_lock_irq(&ehci->lock); 338 + ehci_writel(ehci, PORT_RWC_BITS, 339 + &ehci->regs->port_status[port]); 340 340 } 341 341 } 342 342
+1 -1
drivers/usb/host/max3421-hcd.c
··· 1675 1675 if (pin_number > 7) 1676 1676 return; 1677 1677 1678 - mask = 1u << pin_number; 1678 + mask = 1u << (pin_number % 4); 1679 1679 idx = pin_number / 4; 1680 1680 1681 1681 if (value)
+3
drivers/usb/host/xhci-hub.c
··· 386 386 387 387 ret = 0; 388 388 virt_dev = xhci->devs[slot_id]; 389 + if (!virt_dev) 390 + return -ENODEV; 391 + 389 392 cmd = xhci_alloc_command(xhci, false, true, GFP_NOIO); 390 393 if (!cmd) { 391 394 xhci_dbg(xhci, "Couldn't allocate command structure.\n");
+2 -1
drivers/usb/host/xhci-pci.c
··· 314 314 usb_remove_hcd(xhci->shared_hcd); 315 315 usb_put_hcd(xhci->shared_hcd); 316 316 } 317 - usb_hcd_pci_remove(dev); 318 317 319 318 /* Workaround for spurious wakeups at shutdown with HSW */ 320 319 if (xhci->quirks & XHCI_SPURIOUS_WAKEUP) 321 320 pci_set_power_state(dev, PCI_D3hot); 321 + 322 + usb_hcd_pci_remove(dev); 322 323 } 323 324 324 325 #ifdef CONFIG_PM
+9 -7
drivers/usb/host/xhci-ring.c
··· 1334 1334 1335 1335 cmd = list_entry(xhci->cmd_list.next, struct xhci_command, cmd_list); 1336 1336 1337 - if (cmd->command_trb != xhci->cmd_ring->dequeue) { 1338 - xhci_err(xhci, 1339 - "Command completion event does not match command\n"); 1340 - return; 1341 - } 1342 - 1343 1337 del_timer(&xhci->cmd_timer); 1344 1338 1345 1339 trace_xhci_cmd_completion(cmd_trb, (struct xhci_generic_trb *) event); ··· 1345 1351 xhci_handle_stopped_cmd_ring(xhci, cmd); 1346 1352 return; 1347 1353 } 1354 + 1355 + if (cmd->command_trb != xhci->cmd_ring->dequeue) { 1356 + xhci_err(xhci, 1357 + "Command completion event does not match command\n"); 1358 + return; 1359 + } 1360 + 1348 1361 /* 1349 1362 * Host aborted the command ring, check if the current command was 1350 1363 * supposed to be aborted, otherwise continue normally. ··· 3244 3243 send_addr = addr; 3245 3244 3246 3245 /* Queue the TRBs, even if they are zero-length */ 3247 - for (enqd_len = 0; enqd_len < full_len; enqd_len += trb_buff_len) { 3246 + for (enqd_len = 0; first_trb || enqd_len < full_len; 3247 + enqd_len += trb_buff_len) { 3248 3248 field = TRB_TYPE(TRB_NORMAL); 3249 3249 3250 3250 /* TRB buffer should not cross 64KB boundaries */
+5 -5
drivers/usb/misc/ftdi-elan.c
··· 665 665 { 666 666 char data[30 *3 + 4]; 667 667 char *d = data; 668 - int m = (sizeof(data) - 1) / 3; 668 + int m = (sizeof(data) - 1) / 3 - 1; 669 669 int bytes_read = 0; 670 670 int retry_on_empty = 10; 671 671 int retry_on_timeout = 5; ··· 1684 1684 int i = 0; 1685 1685 char data[30 *3 + 4]; 1686 1686 char *d = data; 1687 - int m = (sizeof(data) - 1) / 3; 1687 + int m = (sizeof(data) - 1) / 3 - 1; 1688 1688 int l = 0; 1689 1689 struct u132_target *target = &ftdi->target[ed]; 1690 1690 struct u132_command *command = &ftdi->command[ ··· 1876 1876 if (packet_bytes > 2) { 1877 1877 char diag[30 *3 + 4]; 1878 1878 char *d = diag; 1879 - int m = (sizeof(diag) - 1) / 3; 1879 + int m = (sizeof(diag) - 1) / 3 - 1; 1880 1880 char *b = ftdi->bulk_in_buffer; 1881 1881 int bytes_read = 0; 1882 1882 diag[0] = 0; ··· 2053 2053 if (packet_bytes > 2) { 2054 2054 char diag[30 *3 + 4]; 2055 2055 char *d = diag; 2056 - int m = (sizeof(diag) - 1) / 3; 2056 + int m = (sizeof(diag) - 1) / 3 - 1; 2057 2057 char *b = ftdi->bulk_in_buffer; 2058 2058 int bytes_read = 0; 2059 2059 unsigned char c = 0; ··· 2155 2155 if (packet_bytes > 2) { 2156 2156 char diag[30 *3 + 4]; 2157 2157 char *d = diag; 2158 - int m = (sizeof(diag) - 1) / 3; 2158 + int m = (sizeof(diag) - 1) / 3 - 1; 2159 2159 char *b = ftdi->bulk_in_buffer; 2160 2160 int bytes_read = 0; 2161 2161 diag[0] = 0;
+5 -4
drivers/usb/misc/usbtest.c
··· 585 585 { 586 586 struct usb_sg_request *req = (struct usb_sg_request *) _req; 587 587 588 - req->status = -ETIMEDOUT; 589 588 usb_sg_cancel(req); 590 589 } 591 590 ··· 615 616 mod_timer(&sg_timer, jiffies + 616 617 msecs_to_jiffies(SIMPLE_IO_TIMEOUT)); 617 618 usb_sg_wait(req); 618 - del_timer_sync(&sg_timer); 619 - retval = req->status; 619 + if (!del_timer_sync(&sg_timer)) 620 + retval = -ETIMEDOUT; 621 + else 622 + retval = req->status; 620 623 621 624 /* FIXME check resulting data pattern */ 622 625 ··· 2603 2602 ktime_get_ts64(&start); 2604 2603 2605 2604 retval = usbtest_do_ioctl(intf, param_32); 2606 - if (retval) 2605 + if (retval < 0) 2607 2606 goto free_mutex; 2608 2607 2609 2608 ktime_get_ts64(&end);
+2
drivers/usb/phy/phy-omap-otg.c
··· 140 140 (rev >> 4) & 0xf, rev & 0xf, config->extcon, otg_dev->id, 141 141 otg_dev->vbus); 142 142 143 + platform_set_drvdata(pdev, otg_dev); 144 + 143 145 return 0; 144 146 } 145 147
+2 -1
drivers/usb/renesas_usbhs/common.c
··· 514 514 if (gpio > 0) 515 515 dparam->enable_gpio = gpio; 516 516 517 - if (dparam->type == USBHS_TYPE_RCAR_GEN2) 517 + if (dparam->type == USBHS_TYPE_RCAR_GEN2 || 518 + dparam->type == USBHS_TYPE_RCAR_GEN3) 518 519 dparam->has_usb_dmac = 1; 519 520 520 521 return info;
+2 -2
drivers/usb/renesas_usbhs/fifo.c
··· 871 871 872 872 /* use PIO if packet is less than pio_dma_border or pipe is DCP */ 873 873 if ((len < usbhs_get_dparam(priv, pio_dma_border)) || 874 - usbhs_pipe_is_dcp(pipe)) 874 + usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_ISOC)) 875 875 goto usbhsf_pio_prepare_push; 876 876 877 877 /* check data length if this driver don't use USB-DMAC */ ··· 976 976 977 977 /* use PIO if packet is less than pio_dma_border or pipe is DCP */ 978 978 if ((pkt->length < usbhs_get_dparam(priv, pio_dma_border)) || 979 - usbhs_pipe_is_dcp(pipe)) 979 + usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_ISOC)) 980 980 goto usbhsf_pio_prepare_pop; 981 981 982 982 fifo = usbhsf_get_dma_fifo(priv, pkt);
+5 -2
drivers/usb/renesas_usbhs/mod_gadget.c
··· 617 617 * use dmaengine if possible. 618 618 * It will use pio handler if impossible. 619 619 */ 620 - if (usb_endpoint_dir_in(desc)) 620 + if (usb_endpoint_dir_in(desc)) { 621 621 pipe->handler = &usbhs_fifo_dma_push_handler; 622 - else 622 + } else { 623 623 pipe->handler = &usbhs_fifo_dma_pop_handler; 624 + usbhs_xxxsts_clear(priv, BRDYSTS, 625 + usbhs_pipe_number(pipe)); 626 + } 624 627 625 628 ret = 0; 626 629 }
+3
drivers/usb/serial/ftdi_sio.c
··· 648 648 { USB_DEVICE(FTDI_VID, FTDI_ELV_TFD128_PID) }, 649 649 { USB_DEVICE(FTDI_VID, FTDI_ELV_FM3RX_PID) }, 650 650 { USB_DEVICE(FTDI_VID, FTDI_ELV_WS777_PID) }, 651 + { USB_DEVICE(FTDI_VID, FTDI_PALMSENS_PID) }, 652 + { USB_DEVICE(FTDI_VID, FTDI_IVIUM_XSTAT_PID) }, 651 653 { USB_DEVICE(FTDI_VID, LINX_SDMUSBQSS_PID) }, 652 654 { USB_DEVICE(FTDI_VID, LINX_MASTERDEVEL2_PID) }, 653 655 { USB_DEVICE(FTDI_VID, LINX_FUTURE_0_PID) }, ··· 1010 1008 { USB_DEVICE(ICPDAS_VID, ICPDAS_I7560U_PID) }, 1011 1009 { USB_DEVICE(ICPDAS_VID, ICPDAS_I7561U_PID) }, 1012 1010 { USB_DEVICE(ICPDAS_VID, ICPDAS_I7563U_PID) }, 1011 + { USB_DEVICE(WICED_VID, WICED_USB20706V2_PID) }, 1013 1012 { } /* Terminating entry */ 1014 1013 }; 1015 1014
+12
drivers/usb/serial/ftdi_sio_ids.h
··· 406 406 #define FTDI_4N_GALAXY_DE_3_PID 0xF3C2 407 407 408 408 /* 409 + * Ivium Technologies product IDs 410 + */ 411 + #define FTDI_PALMSENS_PID 0xf440 412 + #define FTDI_IVIUM_XSTAT_PID 0xf441 413 + 414 + /* 409 415 * Linx Technologies product ids 410 416 */ 411 417 #define LINX_SDMUSBQSS_PID 0xF448 /* Linx SDM-USB-QS-S */ ··· 677 671 #define INTREPID_VID 0x093C 678 672 #define INTREPID_VALUECAN_PID 0x0601 679 673 #define INTREPID_NEOVI_PID 0x0701 674 + 675 + /* 676 + * WICED USB UART 677 + */ 678 + #define WICED_VID 0x0A5C 679 + #define WICED_USB20706V2_PID 0x6422 680 680 681 681 /* 682 682 * Definitions for ID TECH (www.idt-net.com) devices
+22
drivers/usb/serial/option.c
··· 274 274 #define TELIT_PRODUCT_LE920 0x1200 275 275 #define TELIT_PRODUCT_LE910 0x1201 276 276 #define TELIT_PRODUCT_LE910_USBCFG4 0x1206 277 + #define TELIT_PRODUCT_LE920A4_1207 0x1207 278 + #define TELIT_PRODUCT_LE920A4_1208 0x1208 279 + #define TELIT_PRODUCT_LE920A4_1211 0x1211 280 + #define TELIT_PRODUCT_LE920A4_1212 0x1212 281 + #define TELIT_PRODUCT_LE920A4_1213 0x1213 282 + #define TELIT_PRODUCT_LE920A4_1214 0x1214 277 283 278 284 /* ZTE PRODUCTS */ 279 285 #define ZTE_VENDOR_ID 0x19d2 ··· 632 626 static const struct option_blacklist_info telit_le920_blacklist = { 633 627 .sendsetup = BIT(0), 634 628 .reserved = BIT(1) | BIT(5), 629 + }; 630 + 631 + static const struct option_blacklist_info telit_le920a4_blacklist_1 = { 632 + .sendsetup = BIT(0), 633 + .reserved = BIT(1), 635 634 }; 636 635 637 636 static const struct option_blacklist_info telit_le922_blacklist_usbcfg0 = { ··· 1214 1203 .driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg3 }, 1215 1204 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920), 1216 1205 .driver_info = (kernel_ulong_t)&telit_le920_blacklist }, 1206 + { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1207) }, 1207 + { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1208), 1208 + .driver_info = (kernel_ulong_t)&telit_le920a4_blacklist_1 }, 1209 + { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1211), 1210 + .driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg3 }, 1211 + { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1212), 1212 + .driver_info = (kernel_ulong_t)&telit_le920a4_blacklist_1 }, 1213 + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1213, 0xff) }, 1214 + { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1214), 1215 + .driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg3 }, 1217 1216 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */ 1218 1217 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0002, 0xff, 0xff, 0xff), 1219 1218 .driver_info = (kernel_ulong_t)&net_intf1_blacklist }, ··· 1987 1966 .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, 1988 1967 { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* D-Link DWM-152/C1 */ 1989 1968 { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e02, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/C1 */ 1969 + { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x7e11, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/A3 */ 1990 1970 { USB_DEVICE_INTERFACE_CLASS(0x2020, 0x4000, 0xff) }, /* OLICARD300 - MT6225 */ 1991 1971 { USB_DEVICE(INOVIA_VENDOR_ID, INOVIA_SEW858) }, 1992 1972 { USB_DEVICE(VIATELECOM_VENDOR_ID, VIATELECOM_PRODUCT_CDS7) },
+3 -1
drivers/usb/serial/usb-serial.c
··· 1433 1433 1434 1434 rc = usb_register(udriver); 1435 1435 if (rc) 1436 - return rc; 1436 + goto failed_usb_register; 1437 1437 1438 1438 for (sd = serial_drivers; *sd; ++sd) { 1439 1439 (*sd)->usb_driver = udriver; ··· 1451 1451 while (sd-- > serial_drivers) 1452 1452 usb_serial_deregister(*sd); 1453 1453 usb_deregister(udriver); 1454 + failed_usb_register: 1455 + kfree(udriver); 1454 1456 return rc; 1455 1457 } 1456 1458 EXPORT_SYMBOL_GPL(usb_serial_register_drivers);