aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-io.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ide-io.c')
-rw-r--r--drivers/ide/ide-io.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index 3addbe478d26..715379605a7b 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -361,17 +361,21 @@ void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err)
361 spin_unlock_irqrestore(&ide_lock, flags); 361 spin_unlock_irqrestore(&ide_lock, flags);
362 362
363 if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { 363 if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) {
364 ide_task_t *args = (ide_task_t *) rq->special; 364 ide_task_t *task = (ide_task_t *)rq->special;
365
365 if (rq->errors == 0) 366 if (rq->errors == 0)
366 rq->errors = !OK_STAT(stat,READY_STAT,BAD_STAT); 367 rq->errors = !OK_STAT(stat, READY_STAT, BAD_STAT);
367 368
368 if (args) { 369 if (task) {
369 struct ide_taskfile *tf = &args->tf; 370 struct ide_taskfile *tf = &task->tf;
370 371
371 tf->error = err; 372 tf->error = err;
372 tf->status = stat; 373 tf->status = stat;
373 374
374 ide_tf_read(drive, args); 375 ide_tf_read(drive, task);
376
377 if (task->tf_flags & IDE_TFLAG_DYN)
378 kfree(task);
375 } 379 }
376 } else if (blk_pm_request(rq)) { 380 } else if (blk_pm_request(rq)) {
377 struct request_pm_state *pm = rq->data; 381 struct request_pm_state *pm = rq->data;
@@ -388,7 +392,8 @@ void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err)
388 spin_lock_irqsave(&ide_lock, flags); 392 spin_lock_irqsave(&ide_lock, flags);
389 HWGROUP(drive)->rq = NULL; 393 HWGROUP(drive)->rq = NULL;
390 rq->errors = err; 394 rq->errors = err;
391 if (__blk_end_request(rq, (rq->errors ? -EIO : 0), 0)) 395 if (unlikely(__blk_end_request(rq, (rq->errors ? -EIO : 0),
396 blk_rq_bytes(rq))))
392 BUG(); 397 BUG();
393 spin_unlock_irqrestore(&ide_lock, flags); 398 spin_unlock_irqrestore(&ide_lock, flags);
394} 399}