Commit 46d73aed authored by Bartlomiej Zolnierkiewicz's avatar Bartlomiej Zolnierkiewicz Committed by Linus Torvalds

[PATCH] ide: check no. of sectors for in/out commands in ide_diag_taskfile()

Make sure that number of sectors != 0 for in/out command before sending
it to drive.  Remove no longer needed checks from flagged_* PIO handlers.
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@elka.pw.edu.pl>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 18bf941f
......@@ -846,6 +846,12 @@ int ide_diag_taskfile (ide_drive_t *drive, ide_task_t *args, unsigned long data_
else
rq.nr_sectors = data_size / SECTOR_SIZE;
if (!rq.nr_sectors) {
printk(KERN_ERR "%s: in/out command without data\n",
drive->name);
return -EFAULT;
}
rq.hard_nr_sectors = rq.nr_sectors;
rq.hard_cur_sectors = rq.current_nr_sectors = rq.nr_sectors;
}
......@@ -1330,9 +1336,6 @@ ide_startstop_t flagged_task_in_intr (ide_drive_t *drive)
char *pBuf = NULL;
int retries = 5;
if (rq->current_nr_sectors == 0)
return DRIVER(drive)->error(drive, "flagged_task_in_intr (no data requested)", stat);
if (!OK_STAT(stat, DATA_READY, BAD_R_STAT)) {
if (stat & ERR_STAT) {
return DRIVER(drive)->error(drive, "flagged_task_in_intr", stat);
......@@ -1379,9 +1382,6 @@ ide_startstop_t flagged_task_mulin_intr (ide_drive_t *drive)
int retries = 5;
unsigned int msect, nsect;
if (rq->current_nr_sectors == 0)
return DRIVER(drive)->error(drive, "flagged_task_mulin_intr (no data requested)", stat);
msect = drive->mult_count;
if (msect == 0)
return DRIVER(drive)->error(drive, "flagged_task_mulin_intr (multimode not set)", stat);
......@@ -1433,14 +1433,8 @@ ide_startstop_t flagged_task_mulin_intr (ide_drive_t *drive)
*/
ide_startstop_t flagged_pre_task_out_intr (ide_drive_t *drive, struct request *rq)
{
ide_hwif_t *hwif = HWIF(drive);
u8 stat = hwif->INB(IDE_STATUS_REG);
ide_startstop_t startstop;
if (!rq->current_nr_sectors) {
return DRIVER(drive)->error(drive, "flagged_pre_task_out_intr (write data not specified)", stat);
}
if (ide_wait_stat(&startstop, drive, DATA_READY,
BAD_W_STAT, WAIT_DRQ)) {
printk(KERN_ERR "%s: No DRQ bit after issuing write command.\n", drive->name);
......@@ -1502,9 +1496,6 @@ ide_startstop_t flagged_pre_task_mulout_intr (ide_drive_t *drive, struct request
ide_startstop_t startstop;
unsigned int msect, nsect;
if (!rq->current_nr_sectors)
return DRIVER(drive)->error(drive, "flagged_pre_task_mulout_intr (write data not specified)", stat);
msect = drive->mult_count;
if (msect == 0)
return DRIVER(drive)->error(drive, "flagged_pre_task_mulout_intr (multimode not set)", stat);
......
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