summaryrefslogtreecommitdiffstats
path: root/drivers/staging/octeon-usb
diff options
context:
space:
mode:
authorAaro Koskinen <aaro.koskinen@iki.fi>2015-03-22 17:38:00 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-03-24 13:47:13 +0100
commitf3b8edc0f366bd7049eafa11d0c0187f039c0528 (patch)
tree8a425832928d80a360b0205b45b40839b9731979 /drivers/staging/octeon-usb
parenteb04114f37eb434b5bc18293274420d2a664adc2 (diff)
downloadlinux-f3b8edc0f366bd7049eafa11d0c0187f039c0528.tar.gz
linux-f3b8edc0f366bd7049eafa11d0c0187f039c0528.tar.bz2
linux-f3b8edc0f366bd7049eafa11d0c0187f039c0528.zip
staging: octeon-usb: fail and warn if DMA counters are wrong
Fail and WARN if DMA counters are wrong. Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/octeon-usb')
-rw-r--r--drivers/staging/octeon-usb/octeon-hcd.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c
index 84640454ba71..27acab217d21 100644
--- a/drivers/staging/octeon-usb/octeon-hcd.c
+++ b/drivers/staging/octeon-usb/octeon-hcd.c
@@ -2617,6 +2617,17 @@ static int cvmx_usb_poll_channel(struct cvmx_usb_state *usb, int channel)
(pipe->transfer_dir == CVMX_USB_DIRECTION_OUT))
pipe->flags |= CVMX_USB_PIPE_FLAGS_NEED_PING;
+ if (unlikely(WARN_ON_ONCE(bytes_this_transfer < 0))) {
+ /*
+ * In some rare cases the DMA engine seems to get stuck and
+ * keeps substracting same byte count over and over again. In
+ * such case we just need to fail every transaction.
+ */
+ cvmx_usb_perform_complete(usb, pipe, transaction,
+ CVMX_USB_COMPLETE_ERROR);
+ return 0;
+ }
+
if (usbc_hcint.s.stall) {
/*
* STALL as a response means this transaction cannot be