ChangeSet 1.1504.2.45, 2003/12/12 11:03:38-08:00, tchen@on-go.com [PATCH] USB: fix bug when errors happen in ioedgeport driver drivers/usb/serial/io_edgeport.c | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-) diff -Nru a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c --- a/drivers/usb/serial/io_edgeport.c Mon Dec 29 14:21:58 2003 +++ b/drivers/usb/serial/io_edgeport.c Mon Dec 29 14:21:58 2003 @@ -1488,16 +1488,20 @@ usb_sndbulkpipe(edge_serial->serial->dev, edge_serial->bulk_out_endpoint), buffer, count+2, edge_bulk_out_data_callback, edge_port); + /* decrement the number of credits we have by the number we just sent */ + edge_port->txCredits -= count; + edge_port->icount.tx += count; + urb->dev = edge_serial->serial->dev; status = usb_submit_urb(urb, GFP_ATOMIC); if (status) { /* something went wrong */ dbg("%s - usb_submit_urb(write bulk) failed", __FUNCTION__); edge_port->write_in_progress = FALSE; - } else { - /* decrement the number of credits we have by the number we just sent */ - edge_port->txCredits -= count; - edge_port->icount.tx += count; + + /* revert the credits as something bad happened. */ + edge_port->txCredits += count; + edge_port->icount.tx -= count; } dbg("%s wrote %d byte(s) TxCredit %d, Fifo %d", __FUNCTION__, count, edge_port->txCredits, fifo->count); }