[089/119] USB: ftdi_sio: Keep going when write errors are encountered.

Greg KH
2009-12-07T00:17:50Z

[-- Attachment #1: usb-ftdi_sio-keep-going-when-write-errors-are-encountered.patch --]
[-- Type: text/plain, Size: 1405 bytes --]

2.6.31-stable review patch. If anyone has any objections, please let us know.

------------------
From: Eric W. Biederman <ebiederm@xmission.com>

commit 0de6ab8b91f2e1e8e7fc66a8b5c5e8ca82ea16b7 upstream.

The use of urb->actual_length to update tx_outstanding_bytes
implicitly assumes that the number of bytes actually written is the
same as the number of bytes we tried to write. On error that
assumption is violated so just use transfer_buffer_length the number
of bytes we intended to write to the device.

If an error occurs we need to fall through and call
usb_serial_port_softint to wake up processes waiting in
tty_wait_until_sent.

Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
drivers/usb/serial/ftdi_sio.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -1939,7 +1939,7 @@ static void ftdi_write_bulk_callback(str
return;
}
/* account for transferred data */
- countback = urb->actual_length;
+ countback = urb->transfer_buffer_length;
data_offset = priv->write_offset;
if (data_offset > 0) {
/* Subtract the control bytes */
@@ -1952,7 +1952,6 @@ static void ftdi_write_bulk_callback(str

if (status) {
dbg("nonzero write bulk status received: %d", status);
- return;
}

usb_serial_port_softint(port);