usb-ehci: Cleanup itd error handling
All error statuses except for NAK are handled in a switch case, move the handling of NAK into the same switch case. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
553a6a59f6
commit
5eafd438c9
@ -1466,20 +1466,7 @@ static int ehci_process_itd(EHCIState *ehci,
|
|||||||
}
|
}
|
||||||
qemu_sglist_destroy(&ehci->isgl);
|
qemu_sglist_destroy(&ehci->isgl);
|
||||||
|
|
||||||
if (ret == USB_RET_NAK) {
|
if (ret < 0) {
|
||||||
/* no data for us, so do a zero-length transfer */
|
|
||||||
ret = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ret >= 0) {
|
|
||||||
if (!dir) {
|
|
||||||
/* OUT */
|
|
||||||
set_field(&itd->transact[i], len - ret, ITD_XACT_LENGTH);
|
|
||||||
} else {
|
|
||||||
/* IN */
|
|
||||||
set_field(&itd->transact[i], ret, ITD_XACT_LENGTH);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
switch (ret) {
|
switch (ret) {
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "Unexpected iso usb result: %d\n", ret);
|
fprintf(stderr, "Unexpected iso usb result: %d\n", ret);
|
||||||
@ -1495,6 +1482,19 @@ static int ehci_process_itd(EHCIState *ehci,
|
|||||||
itd->transact[i] |= ITD_XACT_BABBLE;
|
itd->transact[i] |= ITD_XACT_BABBLE;
|
||||||
ehci_record_interrupt(ehci, USBSTS_ERRINT);
|
ehci_record_interrupt(ehci, USBSTS_ERRINT);
|
||||||
break;
|
break;
|
||||||
|
case USB_RET_NAK:
|
||||||
|
/* no data for us, so do a zero-length transfer */
|
||||||
|
ret = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ret >= 0) {
|
||||||
|
if (!dir) {
|
||||||
|
/* OUT */
|
||||||
|
set_field(&itd->transact[i], len - ret, ITD_XACT_LENGTH);
|
||||||
|
} else {
|
||||||
|
/* IN */
|
||||||
|
set_field(&itd->transact[i], ret, ITD_XACT_LENGTH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (itd->transact[i] & ITD_XACT_IOC) {
|
if (itd->transact[i] & ITD_XACT_IOC) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user