aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-cd.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ide-cd.c')
-rw-r--r--drivers/ide/ide-cd.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 673628790f10..8bbe222c5e42 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -519,7 +519,7 @@ int ide_cd_queue_pc(ide_drive_t *drive, const unsigned char *cmd,
519 error = blk_execute_rq(drive->queue, info->disk, rq, 0); 519 error = blk_execute_rq(drive->queue, info->disk, rq, 0);
520 520
521 if (buffer) 521 if (buffer)
522 *bufflen = rq->data_len; 522 *bufflen = rq->resid_len;
523 523
524 flags = rq->cmd_flags; 524 flags = rq->cmd_flags;
525 blk_put_request(rq); 525 blk_put_request(rq);
@@ -707,11 +707,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
707 707
708out_end: 708out_end:
709 if (blk_pc_request(rq) && rc == 0) { 709 if (blk_pc_request(rq) && rc == 0) {
710 unsigned int dlen = rq->data_len; 710 if (blk_end_request(rq, 0, rq->data_len))
711
712 rq->data_len = 0;
713
714 if (blk_end_request(rq, 0, dlen))
715 BUG(); 711 BUG();
716 712
717 hwif->rq = NULL; 713 hwif->rq = NULL;
@@ -740,9 +736,10 @@ out_end:
740 nsectors = 1; 736 nsectors = 1;
741 737
742 if (blk_fs_request(rq) == 0) { 738 if (blk_fs_request(rq) == 0) {
743 rq->data_len -= (cmd->nbytes - cmd->nleft); 739 rq->resid_len = rq->data_len -
740 (cmd->nbytes - cmd->nleft);
744 if (uptodate == 0 && (cmd->tf_flags & IDE_TFLAG_WRITE)) 741 if (uptodate == 0 && (cmd->tf_flags & IDE_TFLAG_WRITE))
745 rq->data_len += cmd->last_xfer_len; 742 rq->resid_len += cmd->last_xfer_len;
746 } 743 }
747 744
748 ide_complete_rq(drive, uptodate ? 0 : -EIO, nsectors << 9); 745 ide_complete_rq(drive, uptodate ? 0 : -EIO, nsectors << 9);