From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:60813) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S5GYs-0005Y0-No for qemu-devel@nongnu.org; Wed, 07 Mar 2012 08:06:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S5GYa-0008FU-JG for qemu-devel@nongnu.org; Wed, 07 Mar 2012 08:05:46 -0500 Received: from mx1.redhat.com ([209.132.183.28]:29840) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S5GYa-0008EW-BU for qemu-devel@nongnu.org; Wed, 07 Mar 2012 08:05:28 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q27D5QjF031071 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 7 Mar 2012 08:05:27 -0500 From: Gerd Hoffmann Date: Wed, 7 Mar 2012 14:05:11 +0100 Message-Id: <1331125520-13467-12-git-send-email-kraxel@redhat.com> In-Reply-To: <1331125520-13467-1-git-send-email-kraxel@redhat.com> References: <1331125520-13467-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 11/20] usb-ehci: Cleanup itd error handling List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Hans de Goede , Gerd Hoffmann From: Hans de Goede 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 Signed-off-by: Gerd Hoffmann --- hw/usb-ehci.c | 28 ++++++++++++++-------------- 1 files changed, 14 insertions(+), 14 deletions(-) diff --git a/hw/usb-ehci.c b/hw/usb-ehci.c index 9197298..825fcc0 100644 --- a/hw/usb-ehci.c +++ b/hw/usb-ehci.c @@ -1466,20 +1466,7 @@ static int ehci_process_itd(EHCIState *ehci, } qemu_sglist_destroy(&ehci->isgl); - if (ret == USB_RET_NAK) { - /* 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 { + if (ret < 0) { switch (ret) { default: 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; ehci_record_interrupt(ehci, USBSTS_ERRINT); 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) { -- 1.7.1