ide-cd: unify ide_cd_do_request() exit paths

* Move cdrom_end_request() calls from cdrom_start_rw()
  and ide_cd_prepare_rw_request() to ide_cd_do_request().

* Unify ide_cd_do_request() exit paths.

There should be no functional changes caused by this patch.

Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent 299c4852
...@@ -595,7 +595,6 @@ static ide_startstop_t ide_cd_prepare_rw_request(ide_drive_t *drive, ...@@ -595,7 +595,6 @@ static ide_startstop_t ide_cd_prepare_rw_request(ide_drive_t *drive,
printk(KERN_ERR PFX "%s: %s: buffer botch (%u)\n", printk(KERN_ERR PFX "%s: %s: buffer botch (%u)\n",
drive->name, __func__, drive->name, __func__,
rq->current_nr_sectors); rq->current_nr_sectors);
cdrom_end_request(drive, 0);
return ide_stopped; return ide_stopped;
} }
rq->current_nr_sectors += nskip; rq->current_nr_sectors += nskip;
...@@ -972,10 +971,8 @@ static ide_startstop_t cdrom_start_rw(ide_drive_t *drive, struct request *rq) ...@@ -972,10 +971,8 @@ static ide_startstop_t cdrom_start_rw(ide_drive_t *drive, struct request *rq)
if (write) { if (write) {
/* disk has become write protected */ /* disk has become write protected */
if (get_disk_ro(cd->disk)) { if (get_disk_ro(cd->disk))
cdrom_end_request(drive, 0);
return ide_stopped; return ide_stopped;
}
} else { } else {
/* /*
* We may be retrying this request after an error. Fix up any * We may be retrying this request after an error. Fix up any
...@@ -987,10 +984,8 @@ static ide_startstop_t cdrom_start_rw(ide_drive_t *drive, struct request *rq) ...@@ -987,10 +984,8 @@ static ide_startstop_t cdrom_start_rw(ide_drive_t *drive, struct request *rq)
/* use DMA, if possible / writes *must* be hardware frame aligned */ /* use DMA, if possible / writes *must* be hardware frame aligned */
if ((rq->nr_sectors & (sectors_per_frame - 1)) || if ((rq->nr_sectors & (sectors_per_frame - 1)) ||
(rq->sector & (sectors_per_frame - 1))) { (rq->sector & (sectors_per_frame - 1))) {
if (write) { if (write)
cdrom_end_request(drive, 0);
return ide_stopped; return ide_stopped;
}
drive->dma = 0; drive->dma = 0;
} else } else
drive->dma = !!(drive->dev_flags & IDE_DFLAG_USING_DMA); drive->dma = !!(drive->dev_flags & IDE_DFLAG_USING_DMA);
...@@ -1045,6 +1040,7 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq, ...@@ -1045,6 +1040,7 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,
sector_t block) sector_t block)
{ {
struct ide_cmd cmd; struct ide_cmd cmd;
int uptodate = 0;
ide_debug_log(IDE_DBG_RQ, "cmd: 0x%x, block: %llu", ide_debug_log(IDE_DBG_RQ, "cmd: 0x%x, block: %llu",
rq->cmd[0], (unsigned long long)block); rq->cmd[0], (unsigned long long)block);
...@@ -1053,11 +1049,9 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq, ...@@ -1053,11 +1049,9 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,
blk_dump_rq_flags(rq, "ide_cd_do_request"); blk_dump_rq_flags(rq, "ide_cd_do_request");
if (blk_fs_request(rq)) { if (blk_fs_request(rq)) {
if (cdrom_start_rw(drive, rq) == ide_stopped) if (cdrom_start_rw(drive, rq) == ide_stopped ||
return ide_stopped; ide_cd_prepare_rw_request(drive, rq) == ide_stopped)
goto out_end;
if (ide_cd_prepare_rw_request(drive, rq) == ide_stopped)
return ide_stopped;
} else if (blk_sense_request(rq) || blk_pc_request(rq) || } else if (blk_sense_request(rq) || blk_pc_request(rq) ||
rq->cmd_type == REQ_TYPE_ATA_PC) { rq->cmd_type == REQ_TYPE_ATA_PC) {
if (!rq->timeout) if (!rq->timeout)
...@@ -1066,12 +1060,11 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq, ...@@ -1066,12 +1060,11 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,
cdrom_do_block_pc(drive, rq); cdrom_do_block_pc(drive, rq);
} else if (blk_special_request(rq)) { } else if (blk_special_request(rq)) {
/* right now this can only be a reset... */ /* right now this can only be a reset... */
cdrom_end_request(drive, 1); uptodate = 1;
return ide_stopped; goto out_end;
} else { } else {
blk_dump_rq_flags(rq, DRV_NAME " bad flags"); blk_dump_rq_flags(rq, DRV_NAME " bad flags");
cdrom_end_request(drive, 0); goto out_end;
return ide_stopped;
} }
memset(&cmd, 0, sizeof(cmd)); memset(&cmd, 0, sizeof(cmd));
...@@ -1082,6 +1075,9 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq, ...@@ -1082,6 +1075,9 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,
cmd.rq = rq; cmd.rq = rq;
return ide_issue_pc(drive, &cmd); return ide_issue_pc(drive, &cmd);
out_end:
cdrom_end_request(drive, uptodate);
return ide_stopped;
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment