usb hub: don't return an overrun when there's no new status

This commit is contained in:
espes 2015-10-19 17:38:38 +11:00
parent eac9d5d608
commit d532051a8e
1 changed files with 7 additions and 7 deletions

View File

@ -457,13 +457,6 @@ static void usb_hub_handle_data(USBDevice *dev, USBPacket *p)
unsigned int status;
uint8_t buf[4];
int i, n;
n = (NUM_PORTS + 1 + 7) / 8;
if (p->iov.size == 1) { /* FreeBSD workaround */
n = 1;
} else if (n > p->iov.size) {
p->status = USB_RET_BABBLE;
return;
}
status = 0;
for(i = 0; i < NUM_PORTS; i++) {
port = &s->ports[i];
@ -471,6 +464,13 @@ static void usb_hub_handle_data(USBDevice *dev, USBPacket *p)
status |= (1 << (i + 1));
}
if (status != 0) {
n = (NUM_PORTS + 1 + 7) / 8;
if (p->iov.size == 1) { /* FreeBSD workaround */
n = 1;
} else if (n > p->iov.size) {
p->status = USB_RET_BABBLE;
return;
}
trace_usb_hub_status_report(s->dev.addr, status);
for(i = 0; i < n; i++) {
buf[i] = status >> (8 * i);