This patch fixes up some result-code tests that were missed in previous patches. Greg, please apply.
Matt
# This is a BitKeeper generated patch for the following project:
# Project Name: greg k-h's linux 2.5 USB kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.640 -> 1.641
# drivers/usb/storage/isd200.c 1.20 -> 1.21
# drivers/usb/storage/shuttle_usbat.c 1.21 -> 1.22
# drivers/usb/storage/freecom.c 1.17 -> 1.18
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/11/03 [EMAIL PROTECTED] 1.641
# Fix up some result code checks that were missed earlier.
# --------------------------------------------
#
diff -Nru a/drivers/usb/storage/freecom.c b/drivers/usb/storage/freecom.c
--- a/drivers/usb/storage/freecom.c Sun Nov 3 14:52:37 2002
+++ b/drivers/usb/storage/freecom.c Sun Nov 3 14:52:37 2002
@@ -127,7 +127,7 @@
/* Issue the transfer command. */
result = usb_stor_bulk_msg (us, fxfr, opipe,
FCM_PACKET_LENGTH, &partial);
- if (result != 0) {
+ if (result != USB_STOR_XFER_GOOD) {
US_DEBUGP ("Freecom readdata xpot failure: r=%d, p=%d\n",
result, partial);
@@ -146,7 +146,9 @@
result = usb_stor_bulk_transfer_srb(us, ipipe, srb, count);
US_DEBUGP("freecom_readdata done!\n");
- return result;
+ if (result > USB_STOR_XFER_SHORT)
+ return USB_STOR_TRANSPORT_ERROR;
+ return USB_STOR_TRANSPORT_GOOD;
}
static int
@@ -168,7 +170,7 @@
/* Issue the transfer command. */
result = usb_stor_bulk_msg (us, fxfr, opipe,
FCM_PACKET_LENGTH, &partial);
- if (result != 0) {
+ if (result != USB_STOR_XFER_GOOD) {
US_DEBUGP ("Freecom writedata xpot failure: r=%d, p=%d\n",
result, partial);
@@ -188,7 +190,9 @@
result = usb_stor_bulk_transfer_srb(us, opipe, srb, count);
US_DEBUGP("freecom_writedata done!\n");
- return result;
+ if (result > USB_STOR_XFER_SHORT)
+ return USB_STOR_TRANSPORT_ERROR;
+ return USB_STOR_TRANSPORT_GOOD;
}
/*
@@ -231,7 +235,7 @@
/* The Freecom device will only fail if there is something wrong in
* USB land. It returns the status in its own registers, which
* come back in the bulk pipe. */
- if (result != 0) {
+ if (result != USB_STOR_XFER_GOOD) {
US_DEBUGP ("freecom xport failure: r=%d, p=%d\n",
result, partial);
@@ -255,6 +259,8 @@
US_DEBUGP("freecom_transport(): transfer aborted\n");
return USB_STOR_TRANSPORT_ABORTED;
}
+ if (result != USB_STOR_XFER_GOOD)
+ return USB_STOR_TRANSPORT_ERROR;
US_DEBUG(pdump ((void *) fst, partial));
@@ -284,7 +290,7 @@
* wrong in USB land. It returns the status in its own
* registers, which come back in the bulk pipe.
*/
- if (result != 0) {
+ if (result != USB_STOR_XFER_GOOD) {
US_DEBUGP ("freecom xport failure: r=%d, p=%d\n",
result, partial);
@@ -308,13 +314,14 @@
US_DEBUGP("freecom_transport(): transfer aborted\n");
return USB_STOR_TRANSPORT_ABORTED;
}
+ if (result > USB_STOR_XFER_SHORT)
+ return USB_STOR_TRANSPORT_ERROR;
US_DEBUG(pdump ((void *) fst, partial));
}
- if (partial != 4 || result != 0) {
+ if (partial != 4)
return USB_STOR_TRANSPORT_ERROR;
- }
if ((fst->Status & 1) != 0) {
US_DEBUGP("operation failed\n");
return USB_STOR_TRANSPORT_FAILED;
@@ -369,7 +376,7 @@
US_DEBUGP ("freecom_transport: transfer aborted\n");
return USB_STOR_TRANSPORT_ABORTED;
}
- if (partial != 4 || result != 0)
+ if (partial != 4 || result > USB_STOR_XFER_SHORT)
return USB_STOR_TRANSPORT_ERROR;
if ((fst->Status & ERR_STAT) != 0) {
US_DEBUGP("operation failed\n");
@@ -398,7 +405,7 @@
US_DEBUGP ("freecom_transport: transfer aborted\n");
return USB_STOR_TRANSPORT_ABORTED;
}
- if (partial != 4 || result != 0)
+ if (partial != 4 || result > USB_STOR_XFER_SHORT)
return USB_STOR_TRANSPORT_ERROR;
if ((fst->Status & ERR_STAT) != 0) {
US_DEBUGP("operation failed\n");
diff -Nru a/drivers/usb/storage/isd200.c b/drivers/usb/storage/isd200.c
--- a/drivers/usb/storage/isd200.c Sun Nov 3 14:52:37 2002
+++ b/drivers/usb/storage/isd200.c Sun Nov 3 14:52:37 2002
@@ -660,6 +660,8 @@
switch (bcs.Status) {
case US_BULK_STAT_OK:
/* command good -- note that we could be short on data */
+ if (srb->resid > 0)
+ return ISD200_TRANSPORT_SHORT;
return ISD200_TRANSPORT_GOOD;
case US_BULK_STAT_FAIL:
@@ -764,7 +766,8 @@
}
status = isd200_Bulk_transport(us, &srb, &ata, sizeof(ata.generic));
- if (status != ISD200_TRANSPORT_GOOD) {
+ if (status != ISD200_TRANSPORT_GOOD &&
+ status != ISD200_TRANSPORT_SHORT) {
US_DEBUGP(" isd200_action(0x%02x) error: %d\n",action,status);
status = ISD200_ERROR;
/* need to reset device here */
@@ -846,6 +849,7 @@
break;
case ISD200_TRANSPORT_SHORT:
+ srb->result = GOOD << 1;
if (!((srb->cmnd[0] == REQUEST_SENSE) ||
(srb->cmnd[0] == INQUIRY) ||
(srb->cmnd[0] == MODE_SENSE) ||
diff -Nru a/drivers/usb/storage/shuttle_usbat.c b/drivers/usb/storage/shuttle_usbat.c
--- a/drivers/usb/storage/shuttle_usbat.c Sun Nov 3 14:52:37 2002
+++ b/drivers/usb/storage/shuttle_usbat.c Sun Nov 3 14:52:37 2002
@@ -804,7 +804,8 @@
result = usbat_read(us, USBAT_ATA, 0x17, &status);
US_DEBUGP("Status = %02X\n", status);
-
+ if (result != USB_STOR_XFER_GOOD)
+ return USB_STOR_TRANSPORT_ERROR;
if (srb->cmnd[0] == TEST_UNIT_READY)
transferred = 0;
--
Matthew Dharm Home: [EMAIL PROTECTED]
Maintainer, Linux USB Mass Storage Driver
NYET! The evil stops here!
-- Pitr
User Friendly, 6/22/1998
msg09195/pgp00000.pgp
Description: PGP signature
