- if (endpoint && endpoint->tx_urb && endpoint->tx_urb->actual_length) {
- if (endpoint->last == endpoint->tx_packetSize) {
- /* handle zero length packet here */
- writel(0x0, &inep_regs_p[ep].write_done);
- }
+ if (endpoint->tx_urb &&
+ (endpoint->last == endpoint->tx_packetSize) &&
+ (endpoint->tx_urb->actual_length - endpoint->sent -
+ endpoint->last == 0)) {
+ /* handle zero length packet here */
+ writel(0x0, &inep_regs_p[ep].write_done);
+
+ }
+
+ if (endpoint->tx_urb && endpoint->tx_urb->actual_length) {