From 7a3ea2ad89d710d69954e54178f5135757879380 Mon Sep 17 00:00:00 2001 From: Xiaoguang Wu Date: Fri, 5 Jul 2019 22:55:13 +0800 Subject: [PATCH] DM USB: xHCI: fix corner case of short packet logic The old logic identify the short packet complete status (CS) by comparing the transfered bytes (TB) and the expected transfered bytes (ETB), it is right only when no error happend. If error appears, the TB may be less than the ETB, but DM should report error CS instead of short packet CS. Tracked-On: #3401 Signed-off-by: Xiaoguang Wu Acked-by: Yu Wang --- devicemodel/hw/pci/xhci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devicemodel/hw/pci/xhci.c b/devicemodel/hw/pci/xhci.c index f059e12f4..982ff2677 100644 --- a/devicemodel/hw/pci/xhci.c +++ b/devicemodel/hw/pci/xhci.c @@ -2684,7 +2684,7 @@ pci_xhci_xfer_complete(struct pci_xhci_vdev *xdev, } else rem_len += xfer->data[i].blen; - if (rem_len > 0) + if (err == XHCI_TRB_ERROR_SUCCESS && rem_len > 0) err = XHCI_TRB_ERROR_SHORT_PKT; /* Only interrupt if IOC or short packet */