ChangeSet 1.1286, 2003/12/12 10:18:02-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 Fri Dec 12 15:06:02 2003 +++ b/drivers/usb/serial/io_edgeport.c Fri Dec 12 15:06:02 2003 @@ -1468,15 +1468,19 @@ urb->transfer_flags |= USB_QUEUE_BULK; urb->dev = edge_serial->serial->dev; + /* decrement the number of credits we have by the number we just sent */ + edge_port->txCredits -= count; + edge_port->icount.tx += count; + status = usb_submit_urb(urb); 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 count if 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); }