patch-2.4.25 linux-2.4.25/drivers/usb/serial/io_edgeport.c

Next file: linux-2.4.25/drivers/usb/serial/io_fw_boot.h
Previous file: linux-2.4.25/drivers/usb/serial/ftdi_sio.h
Back to the patch index
Back to the overall index

diff -urN linux-2.4.24/drivers/usb/serial/io_edgeport.c linux-2.4.25/drivers/usb/serial/io_edgeport.c
@@ -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);
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)