Skip to content

Commit

Permalink
ide-cd: clean up cdrom_analyze_sense_data()
Browse files Browse the repository at this point in the history
[bart: fix handling of bio_sectors(failed_command->bio) == 0]

Signed-off-by: Roel Kluin <[email protected]>
Cc: Borislav Petkov <[email protected]>
Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
  • Loading branch information
Roel Kluin authored and bzolnier committed Apr 28, 2008
1 parent a83ead2 commit eee4929
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions drivers/ide/ide-cd.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ static void cdrom_analyze_sense_data(ide_drive_t *drive,
{
unsigned long sector;
unsigned long bio_sectors;
unsigned long valid;
struct cdrom_info *info = drive->driver_data;

if (!cdrom_log_sense(drive, failed_command, sense))
Expand Down Expand Up @@ -173,14 +172,12 @@ static void cdrom_analyze_sense_data(ide_drive_t *drive,
(sense->information[2] << 8) |
(sense->information[3]);

bio_sectors = bio_sectors(failed_command->bio);
if (bio_sectors < 4)
bio_sectors = 4;
if (drive->queue->hardsect_size == 2048)
/* device sector size is 2K */
sector <<= 2;

bio_sectors = max(bio_sectors(failed_command->bio), 4U);
sector &= ~(bio_sectors - 1);
valid = (sector - failed_command->sector) << 9;

if (sector < get_capacity(info->disk) &&
drive->probed_capacity - sector < 4 * 75)
Expand Down

0 comments on commit eee4929

Please sign in to comment.