Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 108427
b: refs/heads/master
c: 59f4ff2
h: refs/heads/master
i:
  108425: cfdb2ac
  108423: be54a76
v: v3
  • Loading branch information
Alan Stern authored and Greg Kroah-Hartman committed Aug 14, 2008
1 parent e74bc07 commit 5e2ee01
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1a21175a615ed346e8043f5e9d60a672266b84b4
refs/heads/master: 59f4ff2ecff4cef36378928cec891785b402e80c
17 changes: 15 additions & 2 deletions trunk/drivers/usb/storage/transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -1032,8 +1032,21 @@ int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us)

/* try to compute the actual residue, based on how much data
* was really transferred and what the device tells us */
if (residue) {
if (!(us->fflags & US_FL_IGNORE_RESIDUE)) {
if (residue && !(us->fflags & US_FL_IGNORE_RESIDUE)) {

/* Heuristically detect devices that generate bogus residues
* by seeing what happens with INQUIRY and READ CAPACITY
* commands.
*/
if (bcs->Status == US_BULK_STAT_OK &&
scsi_get_resid(srb) == 0 &&
((srb->cmnd[0] == INQUIRY &&
transfer_length == 36) ||
(srb->cmnd[0] == READ_CAPACITY &&
transfer_length == 8))) {
us->fflags |= US_FL_IGNORE_RESIDUE;

} else {
residue = min(residue, transfer_length);
scsi_set_resid(srb, max(scsi_get_resid(srb),
(int) residue));
Expand Down

0 comments on commit 5e2ee01

Please sign in to comment.