aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBorislav Petkov <petkovbb@gmail.com>2009-03-31 14:15:34 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-03-31 14:15:34 -0400
commit5b6c942dd1f13835eff8105ec2aa859544a1498d (patch)
tree50eb55d12e53ed1d3b0d2442d6f151265cf9f38f /drivers
parentd80c592c38378c88c568b96963f7a98d927d05fa (diff)
ide-floppy: do not complete rq's prematurely
... and access them afterwards. Simplify rq completing code while at it. Spotted-by: Tejun Heo <tj@kernel.org> Signed-off-by: Borislav Petkov <petkovbb@gmail.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ide/ide-atapi.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c
index 100e6f94b4f0..3e43b889dd64 100644
--- a/drivers/ide/ide-atapi.c
+++ b/drivers/ide/ide-atapi.c
@@ -310,16 +310,14 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive)
310 pc->xferred = pc->req_xfer; 310 pc->xferred = pc->req_xfer;
311 if (drive->pc_update_buffers) 311 if (drive->pc_update_buffers)
312 drive->pc_update_buffers(drive, pc); 312 drive->pc_update_buffers(drive, pc);
313
314 if (drive->media == ide_floppy)
315 ide_complete_rq(drive, 0, blk_rq_bytes(rq));
316 } 313 }
317 debug_log("%s: DMA finished\n", drive->name); 314 debug_log("%s: DMA finished\n", drive->name);
318 } 315 }
319 316
320 /* No more interrupts */ 317 /* No more interrupts */
321 if ((stat & ATA_DRQ) == 0) { 318 if ((stat & ATA_DRQ) == 0) {
322 int uptodate; 319 int uptodate, error;
320 unsigned int done;
323 321
324 debug_log("Packet command completed, %d bytes transferred\n", 322 debug_log("Packet command completed, %d bytes transferred\n",
325 pc->xferred); 323 pc->xferred);
@@ -366,9 +364,9 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive)
366 364
367 if (blk_special_request(rq)) { 365 if (blk_special_request(rq)) {
368 rq->errors = 0; 366 rq->errors = 0;
369 ide_complete_rq(drive, 0, blk_rq_bytes(rq)); 367 done = blk_rq_bytes(rq);
368 error = 0;
370 } else { 369 } else {
371 unsigned int done;
372 370
373 if (blk_fs_request(rq) == 0 && uptodate <= 0) { 371 if (blk_fs_request(rq) == 0 && uptodate <= 0) {
374 if (rq->errors == 0) 372 if (rq->errors == 0)
@@ -380,9 +378,10 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive)
380 else 378 else
381 done = blk_rq_bytes(rq); 379 done = blk_rq_bytes(rq);
382 380
383 ide_complete_rq(drive, uptodate ? 0 : -EIO, done); 381 error = uptodate ? 0 : -EIO;
384 } 382 }
385 383
384 ide_complete_rq(drive, error, done);
386 return ide_stopped; 385 return ide_stopped;
387 } 386 }
388 387