diff options
-rw-r--r-- | payloads/libpayload/drivers/usb/uhci.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/payloads/libpayload/drivers/usb/uhci.c b/payloads/libpayload/drivers/usb/uhci.c index 6cc6b282a2..764770763a 100644 --- a/payloads/libpayload/drivers/usb/uhci.c +++ b/payloads/libpayload/drivers/usb/uhci.c @@ -429,7 +429,10 @@ uhci_bulk (endpoint_t *ep, int size, u8 *data, int finalize) int maxpsize = ep->maxpacketsize; if (maxpsize == 0) fatal("MaxPacketSize == 0!!!"); - int numpackets = (size + maxpsize - 1) / maxpsize + finalize; + int numpackets = (size + maxpsize - 1) / maxpsize; + if (finalize && ((size % maxpsize) == 0)) { + numpackets++; + } if (numpackets == 0) return 0; td_t *tds = create_schedule (numpackets); |