staging: octeon-usb: return transferred bytes only on success
authorAaro Koskinen <aaro.koskinen@iki.fi>
Sun, 29 Jun 2014 19:52:55 +0000 (22:52 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 8 Jul 2014 23:39:22 +0000 (16:39 -0700)
Return transferred bytes only when transfer was successful.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/octeon-usb/octeon-hcd.c

index 59cf921..a65b708 100644 (file)
@@ -2162,7 +2162,11 @@ static void octeon_usb_urb_complete_callback(struct cvmx_usb_state *usb,
        struct usb_hcd *hcd = octeon_to_hcd(priv);
        struct device *dev = hcd->self.controller;
 
-       urb->actual_length = bytes_transferred;
+       if (likely(status == CVMX_USB_COMPLETE_SUCCESS))
+               urb->actual_length = bytes_transferred;
+       else
+               urb->actual_length = 0;
+
        urb->hcpriv = NULL;
 
        /* For Isochronous transactions we need to update the URB packet status