ChangeSet 1.1557.49.11, 2004/02/17 16:44:14-08:00, stern@rowland.harvard.edu

[PATCH] USB Storage: Treat STALL as failure for CB[I]

I recall something like this had to be changed a while ago, but it looks
like it's still not right.  A STALL during either the command or data
phase of a CB[I] command should indicate a failure.


 drivers/usb/storage/transport.c |    8 ++++++++
 1 files changed, 8 insertions(+)


diff -Nru a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
--- a/drivers/usb/storage/transport.c	Thu Feb 19 17:22:12 2004
+++ b/drivers/usb/storage/transport.c	Thu Feb 19 17:22:12 2004
@@ -792,6 +792,10 @@
 					srb->request_buffer, transfer_length,
 					srb->use_sg, &srb->resid);
 		US_DEBUGP("CBI data stage result is 0x%x\n", result);
+
+		/* if we stalled the data transfer it means command failed */
+		if (result == USB_STOR_XFER_STALLED)
+			return USB_STOR_TRANSPORT_FAILED;
 		if (result > USB_STOR_XFER_STALLED)
 			return USB_STOR_TRANSPORT_ERROR;
 	}
@@ -883,6 +887,10 @@
 					srb->request_buffer, transfer_length,
 					srb->use_sg, &srb->resid);
 		US_DEBUGP("CB data stage result is 0x%x\n", result);
+
+		/* if we stalled the data transfer it means command failed */
+		if (result == USB_STOR_XFER_STALLED)
+			return USB_STOR_TRANSPORT_FAILED;
 		if (result > USB_STOR_XFER_STALLED)
 			return USB_STOR_TRANSPORT_ERROR;
 	}
