aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/io_ti.c
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2017-03-16 12:13:43 -0400
committerJohan Hovold <johan@kernel.org>2017-03-28 05:00:11 -0400
commit9c8299b43e577828057988eb8bd4920ab656022b (patch)
treed45ee049765892944954a47ac320aba4dde334c9 /drivers/usb/serial/io_ti.c
parent8d9c4d9ebffe5ed7be34dad7bc4ef4ab6807c501 (diff)
USB: serial: io_ti: verify interrupt endpoint at probe
Verify that the required interrupt endpoint is present at probe rather than at open to avoid allocating resources for an unusable device. Note that the endpoint is only required when in download mode. Signed-off-by: Johan Hovold <johan@kernel.org>
Diffstat (limited to 'drivers/usb/serial/io_ti.c')
-rw-r--r--drivers/usb/serial/io_ti.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
index c315836793b3..a962082cf3b0 100644
--- a/drivers/usb/serial/io_ti.c
+++ b/drivers/usb/serial/io_ti.c
@@ -1933,13 +1933,6 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port)
1933 if (edge_serial->num_ports_open == 0) { 1933 if (edge_serial->num_ports_open == 0) {
1934 /* we are the first port to open, post the interrupt urb */ 1934 /* we are the first port to open, post the interrupt urb */
1935 urb = edge_serial->serial->port[0]->interrupt_in_urb; 1935 urb = edge_serial->serial->port[0]->interrupt_in_urb;
1936 if (!urb) {
1937 dev_err(&port->dev,
1938 "%s - no interrupt urb present, exiting\n",
1939 __func__);
1940 status = -EINVAL;
1941 goto release_es_lock;
1942 }
1943 urb->context = edge_serial; 1936 urb->context = edge_serial;
1944 status = usb_submit_urb(urb, GFP_KERNEL); 1937 status = usb_submit_urb(urb, GFP_KERNEL);
1945 if (status) { 1938 if (status) {
@@ -2553,7 +2546,8 @@ static int edge_calc_num_ports(struct usb_serial *serial,
2553 /* Make sure we have the required endpoints when in download mode. */ 2546 /* Make sure we have the required endpoints when in download mode. */
2554 if (serial->interface->cur_altsetting->desc.bNumEndpoints > 1) { 2547 if (serial->interface->cur_altsetting->desc.bNumEndpoints > 1) {
2555 if (epds->num_bulk_in < num_ports || 2548 if (epds->num_bulk_in < num_ports ||
2556 epds->num_bulk_out < num_ports) { 2549 epds->num_bulk_out < num_ports ||
2550 epds->num_interrupt_in < 1) {
2557 dev_err(dev, "required endpoints missing\n"); 2551 dev_err(dev, "required endpoints missing\n");
2558 return -ENODEV; 2552 return -ENODEV;
2559 } 2553 }