Commit 080ebb15 authored by Linus Torvalds's avatar Linus Torvalds

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
  ...
parents a8414fa3 f1f6d9a8
...@@ -1354,7 +1354,6 @@ static int acm_probe(struct usb_interface *intf, ...@@ -1354,7 +1354,6 @@ static int acm_probe(struct usb_interface *intf,
spin_lock_init(&acm->write_lock); spin_lock_init(&acm->write_lock);
spin_lock_init(&acm->read_lock); spin_lock_init(&acm->read_lock);
mutex_init(&acm->mutex); mutex_init(&acm->mutex);
acm->rx_endpoint = usb_rcvbulkpipe(usb_dev, epread->bEndpointAddress);
acm->is_int_ep = usb_endpoint_xfer_int(epread); acm->is_int_ep = usb_endpoint_xfer_int(epread);
if (acm->is_int_ep) if (acm->is_int_ep)
acm->bInterval = epread->bInterval; acm->bInterval = epread->bInterval;
...@@ -1394,14 +1393,14 @@ static int acm_probe(struct usb_interface *intf, ...@@ -1394,14 +1393,14 @@ static int acm_probe(struct usb_interface *intf,
urb->transfer_dma = rb->dma; urb->transfer_dma = rb->dma;
if (acm->is_int_ep) { if (acm->is_int_ep) {
usb_fill_int_urb(urb, acm->dev, usb_fill_int_urb(urb, acm->dev,
acm->rx_endpoint, usb_rcvintpipe(usb_dev, epread->bEndpointAddress),
rb->base, rb->base,
acm->readsize, acm->readsize,
acm_read_bulk_callback, rb, acm_read_bulk_callback, rb,
acm->bInterval); acm->bInterval);
} else { } else {
usb_fill_bulk_urb(urb, acm->dev, usb_fill_bulk_urb(urb, acm->dev,
acm->rx_endpoint, usb_rcvbulkpipe(usb_dev, epread->bEndpointAddress),
rb->base, rb->base,
acm->readsize, acm->readsize,
acm_read_bulk_callback, rb); acm_read_bulk_callback, rb);
......
...@@ -96,7 +96,6 @@ struct acm { ...@@ -96,7 +96,6 @@ struct acm {
struct acm_rb read_buffers[ACM_NR]; struct acm_rb read_buffers[ACM_NR];
struct acm_wb *putbuffer; /* for acm_tty_put_char() */ struct acm_wb *putbuffer; /* for acm_tty_put_char() */
int rx_buflimit; int rx_buflimit;
int rx_endpoint;
spinlock_t read_lock; spinlock_t read_lock;
int write_used; /* number of non-empty write buffers */ int write_used; /* number of non-empty write buffers */
int transmitting; int transmitting;
......
...@@ -171,6 +171,31 @@ static void usb_parse_ss_endpoint_companion(struct device *ddev, int cfgno, ...@@ -171,6 +171,31 @@ static void usb_parse_ss_endpoint_companion(struct device *ddev, int cfgno,
ep, buffer, size); ep, buffer, size);
} }
static const unsigned short low_speed_maxpacket_maxes[4] = {
[USB_ENDPOINT_XFER_CONTROL] = 8,
[USB_ENDPOINT_XFER_ISOC] = 0,
[USB_ENDPOINT_XFER_BULK] = 0,
[USB_ENDPOINT_XFER_INT] = 8,
};
static const unsigned short full_speed_maxpacket_maxes[4] = {
[USB_ENDPOINT_XFER_CONTROL] = 64,
[USB_ENDPOINT_XFER_ISOC] = 1023,
[USB_ENDPOINT_XFER_BULK] = 64,
[USB_ENDPOINT_XFER_INT] = 64,
};
static const unsigned short high_speed_maxpacket_maxes[4] = {
[USB_ENDPOINT_XFER_CONTROL] = 64,
[USB_ENDPOINT_XFER_ISOC] = 1024,
[USB_ENDPOINT_XFER_BULK] = 512,
[USB_ENDPOINT_XFER_INT] = 1023,
};
static const unsigned short super_speed_maxpacket_maxes[4] = {
[USB_ENDPOINT_XFER_CONTROL] = 512,
[USB_ENDPOINT_XFER_ISOC] = 1024,
[USB_ENDPOINT_XFER_BULK] = 1024,
[USB_ENDPOINT_XFER_INT] = 1024,
};
static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum, static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum,
int asnum, struct usb_host_interface *ifp, int num_ep, int asnum, struct usb_host_interface *ifp, int num_ep,
unsigned char *buffer, int size) unsigned char *buffer, int size)
...@@ -179,6 +204,8 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum, ...@@ -179,6 +204,8 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum,
struct usb_endpoint_descriptor *d; struct usb_endpoint_descriptor *d;
struct usb_host_endpoint *endpoint; struct usb_host_endpoint *endpoint;
int n, i, j, retval; int n, i, j, retval;
unsigned int maxp;
const unsigned short *maxpacket_maxes;
d = (struct usb_endpoint_descriptor *) buffer; d = (struct usb_endpoint_descriptor *) buffer;
buffer += d->bLength; buffer += d->bLength;
...@@ -286,6 +313,42 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum, ...@@ -286,6 +313,42 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum,
endpoint->desc.wMaxPacketSize = cpu_to_le16(8); endpoint->desc.wMaxPacketSize = cpu_to_le16(8);
} }
/* Validate the wMaxPacketSize field */
maxp = usb_endpoint_maxp(&endpoint->desc);
/* Find the highest legal maxpacket size for this endpoint */
i = 0; /* additional transactions per microframe */
switch (to_usb_device(ddev)->speed) {
case USB_SPEED_LOW:
maxpacket_maxes = low_speed_maxpacket_maxes;
break;
case USB_SPEED_FULL:
maxpacket_maxes = full_speed_maxpacket_maxes;
break;
case USB_SPEED_HIGH:
/* Bits 12..11 are allowed only for HS periodic endpoints */
if (usb_endpoint_xfer_int(d) || usb_endpoint_xfer_isoc(d)) {
i = maxp & (BIT(12) | BIT(11));
maxp &= ~i;
}
/* fallthrough */
default:
maxpacket_maxes = high_speed_maxpacket_maxes;
break;
case USB_SPEED_SUPER:
case USB_SPEED_SUPER_PLUS:
maxpacket_maxes = super_speed_maxpacket_maxes;
break;
}
j = maxpacket_maxes[usb_endpoint_type(&endpoint->desc)];
if (maxp > j) {
dev_warn(ddev, "config %d interface %d altsetting %d endpoint 0x%X has invalid maxpacket %d, setting to %d\n",
cfgno, inum, asnum, d->bEndpointAddress, maxp, j);
maxp = j;
endpoint->desc.wMaxPacketSize = cpu_to_le16(i | maxp);
}
/* /*
* Some buggy high speed devices have bulk endpoints using * Some buggy high speed devices have bulk endpoints using
* maxpacket sizes other than 512. High speed HCDs may not * maxpacket sizes other than 512. High speed HCDs may not
...@@ -293,9 +356,6 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum, ...@@ -293,9 +356,6 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum,
*/ */
if (to_usb_device(ddev)->speed == USB_SPEED_HIGH if (to_usb_device(ddev)->speed == USB_SPEED_HIGH
&& usb_endpoint_xfer_bulk(d)) { && usb_endpoint_xfer_bulk(d)) {
unsigned maxp;
maxp = usb_endpoint_maxp(&endpoint->desc) & 0x07ff;
if (maxp != 512) if (maxp != 512)
dev_warn(ddev, "config %d interface %d altsetting %d " dev_warn(ddev, "config %d interface %d altsetting %d "
"bulk endpoint 0x%X has invalid maxpacket %d\n", "bulk endpoint 0x%X has invalid maxpacket %d\n",
......
...@@ -241,7 +241,8 @@ static int usbdev_mmap(struct file *file, struct vm_area_struct *vma) ...@@ -241,7 +241,8 @@ static int usbdev_mmap(struct file *file, struct vm_area_struct *vma)
goto error_decrease_mem; goto error_decrease_mem;
} }
mem = usb_alloc_coherent(ps->dev, size, GFP_USER, &dma_handle); mem = usb_alloc_coherent(ps->dev, size, GFP_USER | __GFP_NOWARN,
&dma_handle);
if (!mem) { if (!mem) {
ret = -ENOMEM; ret = -ENOMEM;
goto error_free_usbm; goto error_free_usbm;
...@@ -2582,7 +2583,9 @@ static unsigned int usbdev_poll(struct file *file, ...@@ -2582,7 +2583,9 @@ static unsigned int usbdev_poll(struct file *file,
if (file->f_mode & FMODE_WRITE && !list_empty(&ps->async_completed)) if (file->f_mode & FMODE_WRITE && !list_empty(&ps->async_completed))
mask |= POLLOUT | POLLWRNORM; mask |= POLLOUT | POLLWRNORM;
if (!connected(ps)) if (!connected(ps))
mask |= POLLERR | POLLHUP; mask |= POLLHUP;
if (list_empty(&ps->list))
mask |= POLLERR;
return mask; return mask;
} }
......
...@@ -1052,14 +1052,11 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) ...@@ -1052,14 +1052,11 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
/* Continue a partial initialization */ /* Continue a partial initialization */
if (type == HUB_INIT2 || type == HUB_INIT3) { if (type == HUB_INIT2 || type == HUB_INIT3) {
device_lock(hub->intfdev); device_lock(&hdev->dev);
/* Was the hub disconnected while we were waiting? */ /* Was the hub disconnected while we were waiting? */
if (hub->disconnected) { if (hub->disconnected)
device_unlock(hub->intfdev); goto disconnected;
kref_put(&hub->kref, hub_release);
return;
}
if (type == HUB_INIT2) if (type == HUB_INIT2)
goto init2; goto init2;
goto init3; goto init3;
...@@ -1262,7 +1259,7 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) ...@@ -1262,7 +1259,7 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
queue_delayed_work(system_power_efficient_wq, queue_delayed_work(system_power_efficient_wq,
&hub->init_work, &hub->init_work,
msecs_to_jiffies(delay)); msecs_to_jiffies(delay));
device_unlock(hub->intfdev); device_unlock(&hdev->dev);
return; /* Continues at init3: below */ return; /* Continues at init3: below */
} else { } else {
msleep(delay); msleep(delay);
...@@ -1281,12 +1278,12 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) ...@@ -1281,12 +1278,12 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
/* Scan all ports that need attention */ /* Scan all ports that need attention */
kick_hub_wq(hub); kick_hub_wq(hub);
/* Allow autosuspend if it was suppressed */ if (type == HUB_INIT2 || type == HUB_INIT3) {
if (type <= HUB_INIT3) /* Allow autosuspend if it was suppressed */
disconnected:
usb_autopm_put_interface_async(to_usb_interface(hub->intfdev)); usb_autopm_put_interface_async(to_usb_interface(hub->intfdev));
device_unlock(&hdev->dev);
if (type == HUB_INIT2 || type == HUB_INIT3) }
device_unlock(hub->intfdev);
kref_put(&hub->kref, hub_release); kref_put(&hub->kref, hub_release);
} }
...@@ -1315,8 +1312,6 @@ static void hub_quiesce(struct usb_hub *hub, enum hub_quiescing_type type) ...@@ -1315,8 +1312,6 @@ static void hub_quiesce(struct usb_hub *hub, enum hub_quiescing_type type)
struct usb_device *hdev = hub->hdev; struct usb_device *hdev = hub->hdev;
int i; int i;
cancel_delayed_work_sync(&hub->init_work);
/* hub_wq and related activity won't re-trigger */ /* hub_wq and related activity won't re-trigger */
hub->quiescing = 1; hub->quiescing = 1;
......
...@@ -61,6 +61,7 @@ static int dwc3_of_simple_probe(struct platform_device *pdev) ...@@ -61,6 +61,7 @@ static int dwc3_of_simple_probe(struct platform_device *pdev)
if (!simple->clks) if (!simple->clks)
return -ENOMEM; return -ENOMEM;
platform_set_drvdata(pdev, simple);
simple->dev = dev; simple->dev = dev;
for (i = 0; i < simple->num_clocks; i++) { for (i = 0; i < simple->num_clocks; i++) {
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#define PCI_DEVICE_ID_INTEL_BXT 0x0aaa #define PCI_DEVICE_ID_INTEL_BXT 0x0aaa
#define PCI_DEVICE_ID_INTEL_BXT_M 0x1aaa #define PCI_DEVICE_ID_INTEL_BXT_M 0x1aaa
#define PCI_DEVICE_ID_INTEL_APL 0x5aaa #define PCI_DEVICE_ID_INTEL_APL 0x5aaa
#define PCI_DEVICE_ID_INTEL_KBP 0xa2b0
static const struct acpi_gpio_params reset_gpios = { 0, 0, false }; static const struct acpi_gpio_params reset_gpios = { 0, 0, false };
static const struct acpi_gpio_params cs_gpios = { 1, 0, false }; static const struct acpi_gpio_params cs_gpios = { 1, 0, false };
...@@ -227,6 +228,7 @@ static const struct pci_device_id dwc3_pci_id_table[] = { ...@@ -227,6 +228,7 @@ static const struct pci_device_id dwc3_pci_id_table[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BXT), }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BXT), },
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BXT_M), }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BXT_M), },
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_APL), }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_APL), },
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_KBP), },
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB), }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB), },
{ } /* Terminating Entry */ { } /* Terminating Entry */
}; };
......
...@@ -829,7 +829,7 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep, ...@@ -829,7 +829,7 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep,
if (!req->request.no_interrupt && !chain) if (!req->request.no_interrupt && !chain)
trb->ctrl |= DWC3_TRB_CTRL_IOC | DWC3_TRB_CTRL_ISP_IMI; trb->ctrl |= DWC3_TRB_CTRL_IOC | DWC3_TRB_CTRL_ISP_IMI;
if (last) if (last && !usb_endpoint_xfer_isoc(dep->endpoint.desc))
trb->ctrl |= DWC3_TRB_CTRL_LST; trb->ctrl |= DWC3_TRB_CTRL_LST;
if (chain) if (chain)
...@@ -1955,7 +1955,8 @@ static void dwc3_gadget_free_endpoints(struct dwc3 *dwc) ...@@ -1955,7 +1955,8 @@ static void dwc3_gadget_free_endpoints(struct dwc3 *dwc)
static int __dwc3_cleanup_done_trbs(struct dwc3 *dwc, struct dwc3_ep *dep, static int __dwc3_cleanup_done_trbs(struct dwc3 *dwc, struct dwc3_ep *dep,
struct dwc3_request *req, struct dwc3_trb *trb, struct dwc3_request *req, struct dwc3_trb *trb,
const struct dwc3_event_depevt *event, int status) const struct dwc3_event_depevt *event, int status,
int chain)
{ {
unsigned int count; unsigned int count;
unsigned int s_pkt = 0; unsigned int s_pkt = 0;
...@@ -1964,17 +1965,22 @@ static int __dwc3_cleanup_done_trbs(struct dwc3 *dwc, struct dwc3_ep *dep, ...@@ -1964,17 +1965,22 @@ static int __dwc3_cleanup_done_trbs(struct dwc3 *dwc, struct dwc3_ep *dep,
dep->queued_requests--; dep->queued_requests--;
trace_dwc3_complete_trb(dep, trb); trace_dwc3_complete_trb(dep, trb);
/*
* If we're in the middle of series of chained TRBs and we
* receive a short transfer along the way, DWC3 will skip
* through all TRBs including the last TRB in the chain (the
* where CHN bit is zero. DWC3 will also avoid clearing HWO
* bit and SW has to do it manually.
*
* We're going to do that here to avoid problems of HW trying
* to use bogus TRBs for transfers.
*/
if (chain && (trb->ctrl & DWC3_TRB_CTRL_HWO))
trb->ctrl &= ~DWC3_TRB_CTRL_HWO;
if ((trb->ctrl & DWC3_TRB_CTRL_HWO) && status != -ESHUTDOWN) if ((trb->ctrl & DWC3_TRB_CTRL_HWO) && status != -ESHUTDOWN)
/* return 1;
* We continue despite the error. There is not much we
* can do. If we don't clean it up we loop forever. If
* we skip the TRB then it gets overwritten after a
* while since we use them in a ring buffer. A BUG()
* would help. Lets hope that if this occurs, someone
* fixes the root cause instead of looking away :)
*/
dev_err(dwc->dev, "%s's TRB (%p) still owned by HW\n",
dep->name, trb);
count = trb->size & DWC3_TRB_SIZE_MASK; count = trb->size & DWC3_TRB_SIZE_MASK;
if (dep->direction) { if (dep->direction) {
...@@ -2013,15 +2019,7 @@ static int __dwc3_cleanup_done_trbs(struct dwc3 *dwc, struct dwc3_ep *dep, ...@@ -2013,15 +2019,7 @@ static int __dwc3_cleanup_done_trbs(struct dwc3 *dwc, struct dwc3_ep *dep,
s_pkt = 1; s_pkt = 1;
} }
/* if (s_pkt && !chain)
* We assume here we will always receive the entire data block
* which we should receive. Meaning, if we program RX to
* receive 4K but we receive only 2K, we assume that's all we
* should receive and we simply bounce the request back to the
* gadget driver for further processing.
*/
req->request.actual += req->request.length - count;
if (s_pkt)
return 1; return 1;
if ((event->status & DEPEVT_STATUS_LST) && if ((event->status & DEPEVT_STATUS_LST) &&
(trb->ctrl & (DWC3_TRB_CTRL_LST | (trb->ctrl & (DWC3_TRB_CTRL_LST |
...@@ -2040,13 +2038,17 @@ static int dwc3_cleanup_done_reqs(struct dwc3 *dwc, struct dwc3_ep *dep, ...@@ -2040,13 +2038,17 @@ static int dwc3_cleanup_done_reqs(struct dwc3 *dwc, struct dwc3_ep *dep,
struct dwc3_trb *trb; struct dwc3_trb *trb;
unsigned int slot; unsigned int slot;
unsigned int i; unsigned int i;
int count = 0;
int ret; int ret;
do { do {
int chain;
req = next_request(&dep->started_list); req = next_request(&dep->started_list);
if (WARN_ON_ONCE(!req)) if (WARN_ON_ONCE(!req))
return 1; return 1;
chain = req->request.num_mapped_sgs > 0;
i = 0; i = 0;
do { do {
slot = req->first_trb_index + i; slot = req->first_trb_index + i;
...@@ -2054,13 +2056,22 @@ static int dwc3_cleanup_done_reqs(struct dwc3 *dwc, struct dwc3_ep *dep, ...@@ -2054,13 +2056,22 @@ static int dwc3_cleanup_done_reqs(struct dwc3 *dwc, struct dwc3_ep *dep,
slot++; slot++;
slot %= DWC3_TRB_NUM; slot %= DWC3_TRB_NUM;
trb = &dep->trb_pool[slot]; trb = &dep->trb_pool[slot];
count += trb->size & DWC3_TRB_SIZE_MASK;
ret = __dwc3_cleanup_done_trbs(dwc, dep, req, trb, ret = __dwc3_cleanup_done_trbs(dwc, dep, req, trb,
event, status); event, status, chain);
if (ret) if (ret)
break; break;
} while (++i < req->request.num_mapped_sgs); } while (++i < req->request.num_mapped_sgs);
/*
* We assume here we will always receive the entire data block
* which we should receive. Meaning, if we program RX to
* receive 4K but we receive only 2K, we assume that's all we
* should receive and we simply bounce the request back to the
* gadget driver for further processing.
*/
req->request.actual += req->request.length - count;
dwc3_gadget_giveback(dep, req, status); dwc3_gadget_giveback(dep, req, status);
if (ret) if (ret)
......
...@@ -1913,6 +1913,8 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) ...@@ -1913,6 +1913,8 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
break; break;
case USB_RECIP_ENDPOINT: case USB_RECIP_ENDPOINT:
if (!cdev->config)
break;
endp = ((w_index & 0x80) >> 3) | (w_index & 0x0f); endp = ((w_index & 0x80) >> 3) | (w_index & 0x0f);
list_for_each_entry(f, &cdev->config->functions, list) { list_for_each_entry(f, &cdev->config->functions, list) {
if (test_bit(endp, f->endpoints)) if (test_bit(endp, f->endpoints))
...@@ -2124,14 +2126,14 @@ int composite_os_desc_req_prepare(struct usb_composite_dev *cdev, ...@@ -2124,14 +2126,14 @@ int composite_os_desc_req_prepare(struct usb_composite_dev *cdev,
cdev->os_desc_req = usb_ep_alloc_request(ep0, GFP_KERNEL); cdev->os_desc_req = usb_ep_alloc_request(ep0, GFP_KERNEL);
if (!cdev->os_desc_req) { if (!cdev->os_desc_req) {
ret = PTR_ERR(cdev->os_desc_req); ret = -ENOMEM;
goto end; goto end;
} }
/* OS feature descriptor length <= 4kB */ /* OS feature descriptor length <= 4kB */
cdev->os_desc_req->buf = kmalloc(4096, GFP_KERNEL); cdev->os_desc_req->buf = kmalloc(4096, GFP_KERNEL);
if (!cdev->os_desc_req->buf) { if (!cdev->os_desc_req->buf) {
ret = PTR_ERR(cdev->os_desc_req->buf); ret = -ENOMEM;
kfree(cdev->os_desc_req); kfree(cdev->os_desc_req);
goto end; goto end;
} }
......
...@@ -1490,7 +1490,9 @@ void unregister_gadget_item(struct config_item *item) ...@@ -1490,7 +1490,9 @@ void unregister_gadget_item(struct config_item *item)
{ {
struct gadget_info *gi = to_gadget_info(item); struct gadget_info *gi = to_gadget_info(item);
mutex_lock(&gi->lock);
unregister_gadget(gi); unregister_gadget(gi);
mutex_unlock(&gi->lock);
} }
EXPORT_SYMBOL_GPL(unregister_gadget_item); EXPORT_SYMBOL_GPL(unregister_gadget_item);
......
...@@ -680,6 +680,12 @@ static int rndis_reset_response(struct rndis_params *params, ...@@ -680,6 +680,12 @@ static int rndis_reset_response(struct rndis_params *params,
{ {
rndis_reset_cmplt_type *resp; rndis_reset_cmplt_type *resp;
rndis_resp_t *r; rndis_resp_t *r;
u8 *xbuf;
u32 length;
/* drain the response queue */
while ((xbuf = rndis_get_next_response(params, &length)))
rndis_free_response(params, xbuf);
r = rndis_add_response(params, sizeof(rndis_reset_cmplt_type)); r = rndis_add_response(params, sizeof(rndis_reset_cmplt_type));
if (!r) if (!r)
......
...@@ -556,7 +556,8 @@ static netdev_tx_t eth_start_xmit(struct sk_buff *skb, ...@@ -556,7 +556,8 @@ static netdev_tx_t eth_start_xmit(struct sk_buff *skb,
/* Multi frame CDC protocols may store the frame for /* Multi frame CDC protocols may store the frame for
* later which is not a dropped frame. * later which is not a dropped frame.
*/ */
if (dev->port_usb->supports_multi_frame) if (dev->port_usb &&
dev->port_usb->supports_multi_frame)
goto multiframe; goto multiframe;
goto drop; goto drop;
} }
......
...@@ -2023,7 +2023,7 @@ static int uvcg_streaming_class_allow_link(struct config_item *src, ...@@ -2023,7 +2023,7 @@ static int uvcg_streaming_class_allow_link(struct config_item *src,
if (!data) { if (!data) {
kfree(*class_array); kfree(*class_array);
*class_array = NULL; *class_array = NULL;
ret = PTR_ERR(data); ret = -ENOMEM;
goto unlock; goto unlock;
} }
cl_arr = *class_array; cl_arr = *class_array;
......
...@@ -542,7 +542,7 @@ static ssize_t ep_aio(struct kiocb *iocb, ...@@ -542,7 +542,7 @@ static ssize_t ep_aio(struct kiocb *iocb,
*/ */
spin_lock_irq(&epdata->dev->lock); spin_lock_irq(&epdata->dev->lock);
value = -ENODEV; value = -ENODEV;
if (unlikely(epdata->ep)) if (unlikely(epdata->ep == NULL))
goto fail; goto fail;
req = usb_ep_alloc_request(epdata->ep, GFP_ATOMIC); req = usb_ep_alloc_request(epdata->ep, GFP_ATOMIC);
...@@ -606,7 +606,7 @@ ep_read_iter(struct kiocb *iocb, struct iov_iter *to) ...@@ -606,7 +606,7 @@ ep_read_iter(struct kiocb *iocb, struct iov_iter *to)
} }
if (is_sync_kiocb(iocb)) { if (is_sync_kiocb(iocb)) {
value = ep_io(epdata, buf, len); value = ep_io(epdata, buf, len);
if (value >= 0 && copy_to_iter(buf, value, to)) if (value >= 0 && (copy_to_iter(buf, value, to) != value))
value = -EFAULT; value = -EFAULT;
} else { } else {
struct kiocb_priv *priv = kzalloc(sizeof *priv, GFP_KERNEL); struct kiocb_priv *priv = kzalloc(sizeof *priv, GFP_KERNEL);
......
...@@ -1145,7 +1145,7 @@ int usb_add_gadget_udc_release(struct device *parent, struct usb_gadget *gadget, ...@@ -1145,7 +1145,7 @@ int usb_add_gadget_udc_release(struct device *parent, struct usb_gadget *gadget,
if (ret != -EPROBE_DEFER) if (ret != -EPROBE_DEFER)
list_del(&driver->pending); list_del(&driver->pending);
if (ret) if (ret)
goto err4; goto err5;
break; break;
} }
} }
...@@ -1154,6 +1154,9 @@ int usb_add_gadget_udc_release(struct device *parent, struct usb_gadget *gadget, ...@@ -1154,6 +1154,9 @@ int usb_add_gadget_udc_release(struct device *parent, struct usb_gadget *gadget,
return 0; return 0;
err5:
device_del(&udc->dev);
err4: err4:
list_del(&udc->list); list_del(&udc->list);
mutex_unlock(&udc_lock); mutex_unlock(&udc_lock);
......
...@@ -2053,7 +2053,7 @@ static void setup_received_handle(struct qe_udc *udc, ...@@ -2053,7 +2053,7 @@ static void setup_received_handle(struct qe_udc *udc,
struct qe_ep *ep; struct qe_ep *ep;
if (wValue != 0 || wLength != 0 if (wValue != 0 || wLength != 0
|| pipe > USB_MAX_ENDPOINTS) || pipe >= USB_MAX_ENDPOINTS)
break; break;
ep = &udc->eps[pipe]; ep = &udc->eps[pipe];
......
...@@ -332,11 +332,11 @@ static void ehci_turn_off_all_ports(struct ehci_hcd *ehci) ...@@ -332,11 +332,11 @@ static void ehci_turn_off_all_ports(struct ehci_hcd *ehci)
int port = HCS_N_PORTS(ehci->hcs_params); int port = HCS_N_PORTS(ehci->hcs_params);
while (port--) { while (port--) {
ehci_writel(ehci, PORT_RWC_BITS,
&ehci->regs->port_status[port]);
spin_unlock_irq(&ehci->lock); spin_unlock_irq(&ehci->lock);
ehci_port_power(ehci, port, false); ehci_port_power(ehci, port, false);
spin_lock_irq(&ehci->lock); spin_lock_irq(&ehci->lock);
ehci_writel(ehci, PORT_RWC_BITS,
&ehci->regs->port_status[port]);
} }
} }
......
...@@ -1675,7 +1675,7 @@ max3421_gpout_set_value(struct usb_hcd *hcd, u8 pin_number, u8 value) ...@@ -1675,7 +1675,7 @@ max3421_gpout_set_value(struct usb_hcd *hcd, u8 pin_number, u8 value)
if (pin_number > 7) if (pin_number > 7)
return; return;
mask = 1u << pin_number; mask = 1u << (pin_number % 4);
idx = pin_number / 4; idx = pin_number / 4;
if (value) if (value)
......
...@@ -386,6 +386,9 @@ static int xhci_stop_device(struct xhci_hcd *xhci, int slot_id, int suspend) ...@@ -386,6 +386,9 @@ static int xhci_stop_device(struct xhci_hcd *xhci, int slot_id, int suspend)
ret = 0; ret = 0;
virt_dev = xhci->devs[slot_id]; virt_dev = xhci->devs[slot_id];
if (!virt_dev)
return -ENODEV;
cmd = xhci_alloc_command(xhci, false, true, GFP_NOIO); cmd = xhci_alloc_command(xhci, false, true, GFP_NOIO);
if (!cmd) { if (!cmd) {
xhci_dbg(xhci, "Couldn't allocate command structure.\n"); xhci_dbg(xhci, "Couldn't allocate command structure.\n");
......
...@@ -314,11 +314,12 @@ static void xhci_pci_remove(struct pci_dev *dev) ...@@ -314,11 +314,12 @@ static void xhci_pci_remove(struct pci_dev *dev)
usb_remove_hcd(xhci->shared_hcd); usb_remove_hcd(xhci->shared_hcd);
usb_put_hcd(xhci->shared_hcd); usb_put_hcd(xhci->shared_hcd);
} }
usb_hcd_pci_remove(dev);
/* Workaround for spurious wakeups at shutdown with HSW */ /* Workaround for spurious wakeups at shutdown with HSW */
if (xhci->quirks & XHCI_SPURIOUS_WAKEUP) if (xhci->quirks & XHCI_SPURIOUS_WAKEUP)
pci_set_power_state(dev, PCI_D3hot); pci_set_power_state(dev, PCI_D3hot);
usb_hcd_pci_remove(dev);
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM
......
...@@ -1334,12 +1334,6 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, ...@@ -1334,12 +1334,6 @@ static void handle_cmd_completion(struct xhci_hcd *xhci,
cmd = list_entry(xhci->cmd_list.next, struct xhci_command, cmd_list); cmd = list_entry(xhci->cmd_list.next, struct xhci_command, cmd_list);
if (cmd->command_trb != xhci->cmd_ring->dequeue) {
xhci_err(xhci,
"Command completion event does not match command\n");
return;
}
del_timer(&xhci->cmd_timer); del_timer(&xhci->cmd_timer);
trace_xhci_cmd_completion(cmd_trb, (struct xhci_generic_trb *) event); trace_xhci_cmd_completion(cmd_trb, (struct xhci_generic_trb *) event);
...@@ -1351,6 +1345,13 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, ...@@ -1351,6 +1345,13 @@ static void handle_cmd_completion(struct xhci_hcd *xhci,
xhci_handle_stopped_cmd_ring(xhci, cmd); xhci_handle_stopped_cmd_ring(xhci, cmd);
return; return;
} }
if (cmd->command_trb != xhci->cmd_ring->dequeue) {
xhci_err(xhci,
"Command completion event does not match command\n");
return;
}
/* /*
* Host aborted the command ring, check if the current command was * Host aborted the command ring, check if the current command was
* supposed to be aborted, otherwise continue normally. * supposed to be aborted, otherwise continue normally.
...@@ -3243,7 +3244,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, ...@@ -3243,7 +3244,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags,
send_addr = addr; send_addr = addr;
/* Queue the TRBs, even if they are zero-length */ /* Queue the TRBs, even if they are zero-length */
for (enqd_len = 0; enqd_len < full_len; enqd_len += trb_buff_len) { for (enqd_len = 0; first_trb || enqd_len < full_len;
enqd_len += trb_buff_len) {
field = TRB_TYPE(TRB_NORMAL); field = TRB_TYPE(TRB_NORMAL);
/* TRB buffer should not cross 64KB boundaries */ /* TRB buffer should not cross 64KB boundaries */
......
...@@ -665,7 +665,7 @@ static ssize_t ftdi_elan_read(struct file *file, char __user *buffer, ...@@ -665,7 +665,7 @@ static ssize_t ftdi_elan_read(struct file *file, char __user *buffer,
{ {
char data[30 *3 + 4]; char data[30 *3 + 4];
char *d = data; char *d = data;
int m = (sizeof(data) - 1) / 3; int m = (sizeof(data) - 1) / 3 - 1;
int bytes_read = 0; int bytes_read = 0;
int retry_on_empty = 10; int retry_on_empty = 10;
int retry_on_timeout = 5; int retry_on_timeout = 5;
...@@ -1684,7 +1684,7 @@ wait:if (ftdi->disconnected > 0) { ...@@ -1684,7 +1684,7 @@ wait:if (ftdi->disconnected > 0) {
int i = 0; int i = 0;
char data[30 *3 + 4]; char data[30 *3 + 4];
char *d = data; char *d = data;
int m = (sizeof(data) - 1) / 3; int m = (sizeof(data) - 1) / 3 - 1;
int l = 0; int l = 0;
struct u132_target *target = &ftdi->target[ed]; struct u132_target *target = &ftdi->target[ed];
struct u132_command *command = &ftdi->command[ struct u132_command *command = &ftdi->command[
...@@ -1876,7 +1876,7 @@ more:{ ...@@ -1876,7 +1876,7 @@ more:{
if (packet_bytes > 2) { if (packet_bytes > 2) {
char diag[30 *3 + 4]; char diag[30 *3 + 4];
char *d = diag; char *d = diag;
int m = (sizeof(diag) - 1) / 3; int m = (sizeof(diag) - 1) / 3 - 1;
char *b = ftdi->bulk_in_buffer; char *b = ftdi->bulk_in_buffer;
int bytes_read = 0; int bytes_read = 0;
diag[0] = 0; diag[0] = 0;
...@@ -2053,7 +2053,7 @@ static int ftdi_elan_synchronize(struct usb_ftdi *ftdi) ...@@ -2053,7 +2053,7 @@ static int ftdi_elan_synchronize(struct usb_ftdi *ftdi)
if (packet_bytes > 2) { if (packet_bytes > 2) {
char diag[30 *3 + 4]; char diag[30 *3 + 4];
char *d = diag; char *d = diag;
int m = (sizeof(diag) - 1) / 3; int m = (sizeof(diag) - 1) / 3 - 1;
char *b = ftdi->bulk_in_buffer; char *b = ftdi->bulk_in_buffer;
int bytes_read = 0; int bytes_read = 0;
unsigned char c = 0; unsigned char c = 0;
...@@ -2155,7 +2155,7 @@ more:{ ...@@ -2155,7 +2155,7 @@ more:{
if (packet_bytes > 2) { if (packet_bytes > 2) {
char diag[30 *3 + 4]; char diag[30 *3 + 4];
char *d = diag; char *d = diag;
int m = (sizeof(diag) - 1) / 3; int m = (sizeof(diag) - 1) / 3 - 1;
char *b = ftdi->bulk_in_buffer; char *b = ftdi->bulk_in_buffer;
int bytes_read = 0; int bytes_read = 0;
diag[0] = 0; diag[0] = 0;
......
...@@ -585,7 +585,6 @@ static void sg_timeout(unsigned long _req) ...@@ -585,7 +585,6 @@ static void sg_timeout(unsigned long _req)
{ {
struct usb_sg_request *req = (struct usb_sg_request *) _req; struct usb_sg_request *req = (struct usb_sg_request *) _req;
req->status = -ETIMEDOUT;
usb_sg_cancel(req); usb_sg_cancel(req);
} }
...@@ -616,8 +615,10 @@ static int perform_sglist( ...@@ -616,8 +615,10 @@ static int perform_sglist(
mod_timer(&sg_timer, jiffies + mod_timer(&sg_timer, jiffies +
msecs_to_jiffies(SIMPLE_IO_TIMEOUT)); msecs_to_jiffies(SIMPLE_IO_TIMEOUT));
usb_sg_wait(req); usb_sg_wait(req);
del_timer_sync(&sg_timer); if (!del_timer_sync(&sg_timer))
retval = req->status; retval = -ETIMEDOUT;
else
retval = req->status;
/* FIXME check resulting data pattern */ /* FIXME check resulting data pattern */
...@@ -2602,7 +2603,7 @@ usbtest_ioctl(struct usb_interface *intf, unsigned int code, void *buf) ...@@ -2602,7 +2603,7 @@ usbtest_ioctl(struct usb_interface *intf, unsigned int code, void *buf)
ktime_get_ts64(&start); ktime_get_ts64(&start);
retval = usbtest_do_ioctl(intf, param_32); retval = usbtest_do_ioctl(intf, param_32);
if (retval) if (retval < 0)
goto free_mutex; goto free_mutex;
ktime_get_ts64(&end); ktime_get_ts64(&end);
......
...@@ -140,6 +140,8 @@ static int omap_otg_probe(struct platform_device *pdev) ...@@ -140,6 +140,8 @@ static int omap_otg_probe(struct platform_device *pdev)
(rev >> 4) & 0xf, rev & 0xf, config->extcon, otg_dev->id, (rev >> 4) & 0xf, rev & 0xf, config->extcon, otg_dev->id,
otg_dev->vbus); otg_dev->vbus);
platform_set_drvdata(pdev, otg_dev);
return 0; return 0;
} }
......
...@@ -514,7 +514,8 @@ static struct renesas_usbhs_platform_info *usbhs_parse_dt(struct device *dev) ...@@ -514,7 +514,8 @@ static struct renesas_usbhs_platform_info *usbhs_parse_dt(struct device *dev)
if (gpio > 0) if (gpio > 0)
dparam->enable_gpio = gpio; dparam->enable_gpio = gpio;
if (dparam->type == USBHS_TYPE_RCAR_GEN2) if (dparam->type == USBHS_TYPE_RCAR_GEN2 ||
dparam->type == USBHS_TYPE_RCAR_GEN3)
dparam->has_usb_dmac = 1; dparam->has_usb_dmac = 1;
return info; return info;
......
...@@ -871,7 +871,7 @@ static int usbhsf_dma_prepare_push(struct usbhs_pkt *pkt, int *is_done) ...@@ -871,7 +871,7 @@ static int usbhsf_dma_prepare_push(struct usbhs_pkt *pkt, int *is_done)
/* use PIO if packet is less than pio_dma_border or pipe is DCP */ /* use PIO if packet is less than pio_dma_border or pipe is DCP */
if ((len < usbhs_get_dparam(priv, pio_dma_border)) || if ((len < usbhs_get_dparam(priv, pio_dma_border)) ||
usbhs_pipe_is_dcp(pipe)) usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_ISOC))
goto usbhsf_pio_prepare_push; goto usbhsf_pio_prepare_push;
/* check data length if this driver don't use USB-DMAC */ /* check data length if this driver don't use USB-DMAC */
...@@ -976,7 +976,7 @@ static int usbhsf_dma_prepare_pop_with_usb_dmac(struct usbhs_pkt *pkt, ...@@ -976,7 +976,7 @@ static int usbhsf_dma_prepare_pop_with_usb_dmac(struct usbhs_pkt *pkt,
/* use PIO if packet is less than pio_dma_border or pipe is DCP */ /* use PIO if packet is less than pio_dma_border or pipe is DCP */
if ((pkt->length < usbhs_get_dparam(priv, pio_dma_border)) || if ((pkt->length < usbhs_get_dparam(priv, pio_dma_border)) ||
usbhs_pipe_is_dcp(pipe)) usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_ISOC))
goto usbhsf_pio_prepare_pop; goto usbhsf_pio_prepare_pop;
fifo = usbhsf_get_dma_fifo(priv, pkt); fifo = usbhsf_get_dma_fifo(priv, pkt);
......
...@@ -617,10 +617,13 @@ static int usbhsg_ep_enable(struct usb_ep *ep, ...@@ -617,10 +617,13 @@ static int usbhsg_ep_enable(struct usb_ep *ep,
* use dmaengine if possible. * use dmaengine if possible.
* It will use pio handler if impossible. * It will use pio handler if impossible.
*/ */
if (usb_endpoint_dir_in(desc)) if (usb_endpoint_dir_in(desc)) {
pipe->handler = &usbhs_fifo_dma_push_handler; pipe->handler = &usbhs_fifo_dma_push_handler;
else } else {
pipe->handler = &usbhs_fifo_dma_pop_handler; pipe->handler = &usbhs_fifo_dma_pop_handler;
usbhs_xxxsts_clear(priv, BRDYSTS,
usbhs_pipe_number(pipe));
}
ret = 0; ret = 0;
} }
......
...@@ -648,6 +648,8 @@ static const struct usb_device_id id_table_combined[] = { ...@@ -648,6 +648,8 @@ static const struct usb_device_id id_table_combined[] = {
{ USB_DEVICE(FTDI_VID, FTDI_ELV_TFD128_PID) }, { USB_DEVICE(FTDI_VID, FTDI_ELV_TFD128_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_ELV_FM3RX_PID) }, { USB_DEVICE(FTDI_VID, FTDI_ELV_FM3RX_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_ELV_WS777_PID) }, { USB_DEVICE(FTDI_VID, FTDI_ELV_WS777_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_PALMSENS_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_IVIUM_XSTAT_PID) },
{ USB_DEVICE(FTDI_VID, LINX_SDMUSBQSS_PID) }, { USB_DEVICE(FTDI_VID, LINX_SDMUSBQSS_PID) },
{ USB_DEVICE(FTDI_VID, LINX_MASTERDEVEL2_PID) }, { USB_DEVICE(FTDI_VID, LINX_MASTERDEVEL2_PID) },
{ USB_DEVICE(FTDI_VID, LINX_FUTURE_0_PID) }, { USB_DEVICE(FTDI_VID, LINX_FUTURE_0_PID) },
...@@ -1008,6 +1010,7 @@ static const struct usb_device_id id_table_combined[] = { ...@@ -1008,6 +1010,7 @@ static const struct usb_device_id id_table_combined[] = {
{ USB_DEVICE(ICPDAS_VID, ICPDAS_I7560U_PID) }, { USB_DEVICE(ICPDAS_VID, ICPDAS_I7560U_PID) },
{ USB_DEVICE(ICPDAS_VID, ICPDAS_I7561U_PID) }, { USB_DEVICE(ICPDAS_VID, ICPDAS_I7561U_PID) },
{ USB_DEVICE(ICPDAS_VID, ICPDAS_I7563U_PID) }, { USB_DEVICE(ICPDAS_VID, ICPDAS_I7563U_PID) },
{ USB_DEVICE(WICED_VID, WICED_USB20706V2_PID) },
{ } /* Terminating entry */ { } /* Terminating entry */
}; };
......
...@@ -405,6 +405,12 @@ ...@@ -405,6 +405,12 @@
#define FTDI_4N_GALAXY_DE_2_PID 0xF3C1 #define FTDI_4N_GALAXY_DE_2_PID 0xF3C1
#define FTDI_4N_GALAXY_DE_3_PID 0xF3C2 #define FTDI_4N_GALAXY_DE_3_PID 0xF3C2
/*
* Ivium Technologies product IDs
*/
#define FTDI_PALMSENS_PID 0xf440
#define FTDI_IVIUM_XSTAT_PID 0xf441
/* /*
* Linx Technologies product ids * Linx Technologies product ids
*/ */
...@@ -672,6 +678,12 @@ ...@@ -672,6 +678,12 @@
#define INTREPID_VALUECAN_PID 0x0601 #define INTREPID_VALUECAN_PID 0x0601
#define INTREPID_NEOVI_PID 0x0701 #define INTREPID_NEOVI_PID 0x0701
/*
* WICED USB UART
*/
#define WICED_VID 0x0A5C
#define WICED_USB20706V2_PID 0x6422
/* /*
* Definitions for ID TECH (www.idt-net.com) devices * Definitions for ID TECH (www.idt-net.com) devices
*/ */
......
...@@ -274,6 +274,12 @@ static void option_instat_callback(struct urb *urb); ...@@ -274,6 +274,12 @@ static void option_instat_callback(struct urb *urb);
#define TELIT_PRODUCT_LE920 0x1200 #define TELIT_PRODUCT_LE920 0x1200
#define TELIT_PRODUCT_LE910 0x1201 #define TELIT_PRODUCT_LE910 0x1201
#define TELIT_PRODUCT_LE910_USBCFG4 0x1206 #define TELIT_PRODUCT_LE910_USBCFG4 0x1206
#define TELIT_PRODUCT_LE920A4_1207 0x1207
#define TELIT_PRODUCT_LE920A4_1208 0x1208
#define TELIT_PRODUCT_LE920A4_1211 0x1211
#define TELIT_PRODUCT_LE920A4_1212 0x1212
#define TELIT_PRODUCT_LE920A4_1213 0x1213
#define TELIT_PRODUCT_LE920A4_1214 0x1214
/* ZTE PRODUCTS */ /* ZTE PRODUCTS */
#define ZTE_VENDOR_ID 0x19d2 #define ZTE_VENDOR_ID 0x19d2
...@@ -628,6 +634,11 @@ static const struct option_blacklist_info telit_le920_blacklist = { ...@@ -628,6 +634,11 @@ static const struct option_blacklist_info telit_le920_blacklist = {
.reserved = BIT(1) | BIT(5), .reserved = BIT(1) | BIT(5),
}; };
static const struct option_blacklist_info telit_le920a4_blacklist_1 = {
.sendsetup = BIT(0),
.reserved = BIT(1),
};
static const struct option_blacklist_info telit_le922_blacklist_usbcfg0 = { static const struct option_blacklist_info telit_le922_blacklist_usbcfg0 = {
.sendsetup = BIT(2), .sendsetup = BIT(2),
.reserved = BIT(0) | BIT(1) | BIT(3), .reserved = BIT(0) | BIT(1) | BIT(3),
...@@ -1203,6 +1214,16 @@ static const struct usb_device_id option_ids[] = { ...@@ -1203,6 +1214,16 @@ static const struct usb_device_id option_ids[] = {
.driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg3 }, .driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg3 },
{ USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920), { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920),
.driver_info = (kernel_ulong_t)&telit_le920_blacklist }, .driver_info = (kernel_ulong_t)&telit_le920_blacklist },
{ USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1207) },
{ USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1208),
.driver_info = (kernel_ulong_t)&telit_le920a4_blacklist_1 },
{ USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1211),
.driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg3 },
{ USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1212),
.driver_info = (kernel_ulong_t)&telit_le920a4_blacklist_1 },
{ USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1213, 0xff) },
{ USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1214),
.driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg3 },
{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */
{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0002, 0xff, 0xff, 0xff), { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0002, 0xff, 0xff, 0xff),
.driver_info = (kernel_ulong_t)&net_intf1_blacklist }, .driver_info = (kernel_ulong_t)&net_intf1_blacklist },
...@@ -1966,6 +1987,7 @@ static const struct usb_device_id option_ids[] = { ...@@ -1966,6 +1987,7 @@ static const struct usb_device_id option_ids[] = {
.driver_info = (kernel_ulong_t)&net_intf4_blacklist }, .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
{ USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* D-Link DWM-152/C1 */ { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* D-Link DWM-152/C1 */
{ USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e02, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/C1 */ { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e02, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/C1 */
{ USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x7e11, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/A3 */
{ USB_DEVICE_INTERFACE_CLASS(0x2020, 0x4000, 0xff) }, /* OLICARD300 - MT6225 */ { USB_DEVICE_INTERFACE_CLASS(0x2020, 0x4000, 0xff) }, /* OLICARD300 - MT6225 */
{ USB_DEVICE(INOVIA_VENDOR_ID, INOVIA_SEW858) }, { USB_DEVICE(INOVIA_VENDOR_ID, INOVIA_SEW858) },
{ USB_DEVICE(VIATELECOM_VENDOR_ID, VIATELECOM_PRODUCT_CDS7) }, { USB_DEVICE(VIATELECOM_VENDOR_ID, VIATELECOM_PRODUCT_CDS7) },
......
...@@ -1433,7 +1433,7 @@ int usb_serial_register_drivers(struct usb_serial_driver *const serial_drivers[] ...@@ -1433,7 +1433,7 @@ int usb_serial_register_drivers(struct usb_serial_driver *const serial_drivers[]
rc = usb_register(udriver); rc = usb_register(udriver);
if (rc) if (rc)
return rc; goto failed_usb_register;
for (sd = serial_drivers; *sd; ++sd) { for (sd = serial_drivers; *sd; ++sd) {
(*sd)->usb_driver = udriver; (*sd)->usb_driver = udriver;
...@@ -1451,6 +1451,8 @@ int usb_serial_register_drivers(struct usb_serial_driver *const serial_drivers[] ...@@ -1451,6 +1451,8 @@ int usb_serial_register_drivers(struct usb_serial_driver *const serial_drivers[]
while (sd-- > serial_drivers) while (sd-- > serial_drivers)
usb_serial_deregister(*sd); usb_serial_deregister(*sd);
usb_deregister(udriver); usb_deregister(udriver);
failed_usb_register:
kfree(udriver);
return rc; return rc;
} }
EXPORT_SYMBOL_GPL(usb_serial_register_drivers); EXPORT_SYMBOL_GPL(usb_serial_register_drivers);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment