diff options
Diffstat (limited to 'drivers/usb/storage/transport.c')
-rw-r--r-- | drivers/usb/storage/transport.c | 36 |
1 files changed, 3 insertions, 33 deletions
diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c index 1d5438e6363..fb65d221ced 100644 --- a/drivers/usb/storage/transport.c +++ b/drivers/usb/storage/transport.c | |||
@@ -558,32 +558,10 @@ static void last_sector_hacks(struct us_data *us, struct scsi_cmnd *srb) | |||
558 | 558 | ||
559 | if (srb->result == SAM_STAT_GOOD && scsi_get_resid(srb) == 0) { | 559 | if (srb->result == SAM_STAT_GOOD && scsi_get_resid(srb) == 0) { |
560 | 560 | ||
561 | /* The command succeeded. If the capacity is odd | 561 | /* The command succeeded. We know this device doesn't |
562 | * (i.e., if the sector number is even) then the | 562 | * have the last-sector bug, so stop checking it. |
563 | * "always-even" heuristic would be wrong for this | ||
564 | * device. Issue a WARN() so that the kerneloops.org | ||
565 | * project will be notified and we will then know to | ||
566 | * mark the device with a CAPACITY_OK flag. Hopefully | ||
567 | * this will occur for only a few devices. | ||
568 | * | ||
569 | * Use the sign of us->last_sector_hacks to tell whether | ||
570 | * the warning has already been issued; we don't need | ||
571 | * more than one warning per device. | ||
572 | */ | 563 | */ |
573 | if (!(sector & 1) && us->use_last_sector_hacks > 0) { | 564 | us->use_last_sector_hacks = 0; |
574 | unsigned vid = le16_to_cpu( | ||
575 | us->pusb_dev->descriptor.idVendor); | ||
576 | unsigned pid = le16_to_cpu( | ||
577 | us->pusb_dev->descriptor.idProduct); | ||
578 | unsigned rev = le16_to_cpu( | ||
579 | us->pusb_dev->descriptor.bcdDevice); | ||
580 | |||
581 | WARN(1, "%s: Successful last sector success at %u, " | ||
582 | "device %04x:%04x:%04x\n", | ||
583 | sdkp->disk->disk_name, sector, | ||
584 | vid, pid, rev); | ||
585 | us->use_last_sector_hacks = -1; | ||
586 | } | ||
587 | 565 | ||
588 | } else { | 566 | } else { |
589 | /* The command failed. Allow up to 3 retries in case this | 567 | /* The command failed. Allow up to 3 retries in case this |
@@ -599,14 +577,6 @@ static void last_sector_hacks(struct us_data *us, struct scsi_cmnd *srb) | |||
599 | srb->result = SAM_STAT_CHECK_CONDITION; | 577 | srb->result = SAM_STAT_CHECK_CONDITION; |
600 | memcpy(srb->sense_buffer, record_not_found, | 578 | memcpy(srb->sense_buffer, record_not_found, |
601 | sizeof(record_not_found)); | 579 | sizeof(record_not_found)); |
602 | |||
603 | /* In theory we might want to issue a WARN() here if the | ||
604 | * capacity is even, since it could indicate the device | ||
605 | * has the READ CAPACITY bug _and_ the real capacity is | ||
606 | * odd. But it could also indicate that the device | ||
607 | * simply can't access its last sector, a failure mode | ||
608 | * which is surprisingly common. So no warning. | ||
609 | */ | ||
610 | } | 580 | } |
611 | 581 | ||
612 | done: | 582 | done: |