diff options
Diffstat (limited to 'drivers/usb/serial/ftdi_sio.c')
-rw-r--r-- | drivers/usb/serial/ftdi_sio.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 8ff9d54b21e6..95a1805b064f 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -342,6 +342,7 @@ static struct usb_device_id id_table_combined [] = { | |||
342 | { USB_DEVICE(FTDI_VID, FTDI_PERLE_ULTRAPORT_PID) }, | 342 | { USB_DEVICE(FTDI_VID, FTDI_PERLE_ULTRAPORT_PID) }, |
343 | { USB_DEVICE(FTDI_VID, FTDI_PIEGROUP_PID) }, | 343 | { USB_DEVICE(FTDI_VID, FTDI_PIEGROUP_PID) }, |
344 | { USB_DEVICE(FTDI_VID, FTDI_TNC_X_PID) }, | 344 | { USB_DEVICE(FTDI_VID, FTDI_TNC_X_PID) }, |
345 | { USB_DEVICE(FTDI_VID, FTDI_USBX_707_PID) }, | ||
345 | { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2101_PID) }, | 346 | { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2101_PID) }, |
346 | { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2102_PID) }, | 347 | { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2102_PID) }, |
347 | { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2103_PID) }, | 348 | { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2103_PID) }, |
@@ -1433,6 +1434,7 @@ static int ftdi_write (struct usb_serial_port *port, | |||
1433 | dbg("%s - write limit hit\n", __FUNCTION__); | 1434 | dbg("%s - write limit hit\n", __FUNCTION__); |
1434 | return 0; | 1435 | return 0; |
1435 | } | 1436 | } |
1437 | priv->tx_outstanding_urbs++; | ||
1436 | spin_unlock_irqrestore(&priv->tx_lock, flags); | 1438 | spin_unlock_irqrestore(&priv->tx_lock, flags); |
1437 | 1439 | ||
1438 | data_offset = priv->write_offset; | 1440 | data_offset = priv->write_offset; |
@@ -1450,14 +1452,15 @@ static int ftdi_write (struct usb_serial_port *port, | |||
1450 | buffer = kmalloc (transfer_size, GFP_ATOMIC); | 1452 | buffer = kmalloc (transfer_size, GFP_ATOMIC); |
1451 | if (!buffer) { | 1453 | if (!buffer) { |
1452 | err("%s ran out of kernel memory for urb ...", __FUNCTION__); | 1454 | err("%s ran out of kernel memory for urb ...", __FUNCTION__); |
1453 | return -ENOMEM; | 1455 | count = -ENOMEM; |
1456 | goto error_no_buffer; | ||
1454 | } | 1457 | } |
1455 | 1458 | ||
1456 | urb = usb_alloc_urb(0, GFP_ATOMIC); | 1459 | urb = usb_alloc_urb(0, GFP_ATOMIC); |
1457 | if (!urb) { | 1460 | if (!urb) { |
1458 | err("%s - no more free urbs", __FUNCTION__); | 1461 | err("%s - no more free urbs", __FUNCTION__); |
1459 | kfree (buffer); | 1462 | count = -ENOMEM; |
1460 | return -ENOMEM; | 1463 | goto error_no_urb; |
1461 | } | 1464 | } |
1462 | 1465 | ||
1463 | /* Copy data */ | 1466 | /* Copy data */ |
@@ -1499,10 +1502,9 @@ static int ftdi_write (struct usb_serial_port *port, | |||
1499 | if (status) { | 1502 | if (status) { |
1500 | err("%s - failed submitting write urb, error %d", __FUNCTION__, status); | 1503 | err("%s - failed submitting write urb, error %d", __FUNCTION__, status); |
1501 | count = status; | 1504 | count = status; |
1502 | kfree (buffer); | 1505 | goto error; |
1503 | } else { | 1506 | } else { |
1504 | spin_lock_irqsave(&priv->tx_lock, flags); | 1507 | spin_lock_irqsave(&priv->tx_lock, flags); |
1505 | ++priv->tx_outstanding_urbs; | ||
1506 | priv->tx_outstanding_bytes += count; | 1508 | priv->tx_outstanding_bytes += count; |
1507 | priv->tx_bytes += count; | 1509 | priv->tx_bytes += count; |
1508 | spin_unlock_irqrestore(&priv->tx_lock, flags); | 1510 | spin_unlock_irqrestore(&priv->tx_lock, flags); |
@@ -1510,10 +1512,19 @@ static int ftdi_write (struct usb_serial_port *port, | |||
1510 | 1512 | ||
1511 | /* we are done with this urb, so let the host driver | 1513 | /* we are done with this urb, so let the host driver |
1512 | * really free it when it is finished with it */ | 1514 | * really free it when it is finished with it */ |
1513 | usb_free_urb (urb); | 1515 | usb_free_urb(urb); |
1514 | 1516 | ||
1515 | dbg("%s write returning: %d", __FUNCTION__, count); | 1517 | dbg("%s write returning: %d", __FUNCTION__, count); |
1516 | return count; | 1518 | return count; |
1519 | error: | ||
1520 | usb_free_urb(urb); | ||
1521 | error_no_urb: | ||
1522 | kfree (buffer); | ||
1523 | error_no_buffer: | ||
1524 | spin_lock_irqsave(&priv->tx_lock, flags); | ||
1525 | priv->tx_outstanding_urbs--; | ||
1526 | spin_unlock_irqrestore(&priv->tx_lock, flags); | ||
1527 | return count; | ||
1517 | } /* ftdi_write */ | 1528 | } /* ftdi_write */ |
1518 | 1529 | ||
1519 | 1530 | ||