aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/ub.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block/ub.c')
-rw-r--r--drivers/block/ub.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/drivers/block/ub.c b/drivers/block/ub.c
index 5c6a6e89d2fb..e2c3ebd8db22 100644
--- a/drivers/block/ub.c
+++ b/drivers/block/ub.c
@@ -319,6 +319,7 @@ struct ub_dev {
319 int openc; /* protected by ub_lock! */ 319 int openc; /* protected by ub_lock! */
320 /* kref is too implicit for our taste */ 320 /* kref is too implicit for our taste */
321 int reset; /* Reset is running */ 321 int reset; /* Reset is running */
322 int bad_resid;
322 unsigned int tagcnt; 323 unsigned int tagcnt;
323 char name[12]; 324 char name[12];
324 struct usb_device *dev; 325 struct usb_device *dev;
@@ -1265,14 +1266,19 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
1265 return; 1266 return;
1266 } 1267 }
1267 1268
1268 len = le32_to_cpu(bcs->Residue); 1269 if (!sc->bad_resid) {
1269 if (len != cmd->len - cmd->act_len) { 1270 len = le32_to_cpu(bcs->Residue);
1270 /* 1271 if (len != cmd->len - cmd->act_len) {
1271 * It is all right to transfer less, the caller has 1272 /*
1272 * to check. But it's not all right if the device 1273 * Only start ignoring if this cmd ended well.
1273 * counts disagree with our counts. 1274 */
1274 */ 1275 if (cmd->len == cmd->act_len) {
1275 goto Bad_End; 1276 printk(KERN_NOTICE "%s: "
1277 "bad residual %d of %d, ignoring\n",
1278 sc->name, len, cmd->len);
1279 sc->bad_resid = 1;
1280 }
1281 }
1276 } 1282 }
1277 1283
1278 switch (bcs->Status) { 1284 switch (bcs->Status) {