aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/io_ti.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-01-08 14:42:04 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-01-08 14:42:04 -0500
commit83280e90ef001f77a64e2ce59c25ab66e47ab1f0 (patch)
treeec0a5842e2fbc0f4abaff55299acac397b8da5c3 /drivers/usb/serial/io_ti.c
parentcc250e267bd56c531b0bee455fc724d50af83fac (diff)
parent0a8fd1346254974c3a852338508e4a4cddbb35f1 (diff)
Merge tag 'usb-4.10-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB fixes from Greg KH: "Here are a bunch of USB fixes for 4.10-rc3. Yeah, it's a lot, an artifact of the holiday break I think. Lots of gadget and the usual XHCI fixups for reported issues (one day that driver will calm down...) Also included are a bunch of usb-serial driver fixes, and for good measure, a number of much-reported MUSB driver issues have finally been resolved. All of these have been in linux-next with no reported issues" * tag 'usb-4.10-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (72 commits) USB: fix problems with duplicate endpoint addresses usb: ohci-at91: use descriptor-based gpio APIs correctly usb: storage: unusual_uas: Add JMicron JMS56x to unusual device usb: hub: Move hub_port_disable() to fix warning if PM is disabled usb: musb: blackfin: add bfin_fifo_offset in bfin_ops usb: musb: fix compilation warning on unused function usb: musb: Fix trying to free already-free IRQ 4 usb: musb: dsps: implement clear_ep_rxintr() callback usb: musb: core: add clear_ep_rxintr() to musb_platform_ops USB: serial: ti_usb_3410_5052: fix NULL-deref at open USB: serial: spcp8x5: fix NULL-deref at open USB: serial: quatech2: fix sleep-while-atomic in close USB: serial: pl2303: fix NULL-deref at open USB: serial: oti6858: fix NULL-deref at open USB: serial: omninet: fix NULL-derefs at open and disconnect USB: serial: mos7840: fix misleading interrupt-URB comment USB: serial: mos7840: remove unused write URB USB: serial: mos7840: fix NULL-deref at open USB: serial: mos7720: remove obsolete port initialisation USB: serial: mos7720: fix parallel probe ...
Diffstat (limited to 'drivers/usb/serial/io_ti.c')
-rw-r--r--drivers/usb/serial/io_ti.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
index c339163698eb..9a0db2965fbb 100644
--- a/drivers/usb/serial/io_ti.c
+++ b/drivers/usb/serial/io_ti.c
@@ -1499,8 +1499,7 @@ static int do_boot_mode(struct edgeport_serial *serial,
1499 1499
1500 dev_dbg(dev, "%s - Download successful -- Device rebooting...\n", __func__); 1500 dev_dbg(dev, "%s - Download successful -- Device rebooting...\n", __func__);
1501 1501
1502 /* return an error on purpose */ 1502 return 1;
1503 return -ENODEV;
1504 } 1503 }
1505 1504
1506stayinbootmode: 1505stayinbootmode:
@@ -1508,7 +1507,7 @@ stayinbootmode:
1508 dev_dbg(dev, "%s - STAYING IN BOOT MODE\n", __func__); 1507 dev_dbg(dev, "%s - STAYING IN BOOT MODE\n", __func__);
1509 serial->product_info.TiMode = TI_MODE_BOOT; 1508 serial->product_info.TiMode = TI_MODE_BOOT;
1510 1509
1511 return 0; 1510 return 1;
1512} 1511}
1513 1512
1514static int ti_do_config(struct edgeport_port *port, int feature, int on) 1513static int ti_do_config(struct edgeport_port *port, int feature, int on)
@@ -2546,6 +2545,13 @@ static int edge_startup(struct usb_serial *serial)
2546 int status; 2545 int status;
2547 u16 product_id; 2546 u16 product_id;
2548 2547
2548 /* Make sure we have the required endpoints when in download mode. */
2549 if (serial->interface->cur_altsetting->desc.bNumEndpoints > 1) {
2550 if (serial->num_bulk_in < serial->num_ports ||
2551 serial->num_bulk_out < serial->num_ports)
2552 return -ENODEV;
2553 }
2554
2549 /* create our private serial structure */ 2555 /* create our private serial structure */
2550 edge_serial = kzalloc(sizeof(struct edgeport_serial), GFP_KERNEL); 2556 edge_serial = kzalloc(sizeof(struct edgeport_serial), GFP_KERNEL);
2551 if (!edge_serial) 2557 if (!edge_serial)
@@ -2553,14 +2559,18 @@ static int edge_startup(struct usb_serial *serial)
2553 2559
2554 mutex_init(&edge_serial->es_lock); 2560 mutex_init(&edge_serial->es_lock);
2555 edge_serial->serial = serial; 2561 edge_serial->serial = serial;
2562 INIT_DELAYED_WORK(&edge_serial->heartbeat_work, edge_heartbeat_work);
2556 usb_set_serial_data(serial, edge_serial); 2563 usb_set_serial_data(serial, edge_serial);
2557 2564
2558 status = download_fw(edge_serial); 2565 status = download_fw(edge_serial);
2559 if (status) { 2566 if (status < 0) {
2560 kfree(edge_serial); 2567 kfree(edge_serial);
2561 return status; 2568 return status;
2562 } 2569 }
2563 2570
2571 if (status > 0)
2572 return 1; /* bind but do not register any ports */
2573
2564 product_id = le16_to_cpu( 2574 product_id = le16_to_cpu(
2565 edge_serial->serial->dev->descriptor.idProduct); 2575 edge_serial->serial->dev->descriptor.idProduct);
2566 2576
@@ -2572,7 +2582,6 @@ static int edge_startup(struct usb_serial *serial)
2572 } 2582 }
2573 } 2583 }
2574 2584
2575 INIT_DELAYED_WORK(&edge_serial->heartbeat_work, edge_heartbeat_work);
2576 edge_heartbeat_schedule(edge_serial); 2585 edge_heartbeat_schedule(edge_serial);
2577 2586
2578 return 0; 2587 return 0;
@@ -2580,6 +2589,9 @@ static int edge_startup(struct usb_serial *serial)
2580 2589
2581static void edge_disconnect(struct usb_serial *serial) 2590static void edge_disconnect(struct usb_serial *serial)
2582{ 2591{
2592 struct edgeport_serial *edge_serial = usb_get_serial_data(serial);
2593
2594 cancel_delayed_work_sync(&edge_serial->heartbeat_work);
2583} 2595}
2584 2596
2585static void edge_release(struct usb_serial *serial) 2597static void edge_release(struct usb_serial *serial)