]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/ide/ide-io.c
x86: if we cannot calibrate the TSC, we panic.
[linux-2.6-omap-h63xx.git] / drivers / ide / ide-io.c
index 3addbe478d26743701ba669c4ae6acf5b2050725..715379605a7bb55f887eb887832c4765eccab485 100644 (file)
@@ -361,17 +361,21 @@ void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err)
        spin_unlock_irqrestore(&ide_lock, flags);
 
        if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) {
-               ide_task_t *args = (ide_task_t *) rq->special;
+               ide_task_t *task = (ide_task_t *)rq->special;
+
                if (rq->errors == 0)
-                       rq->errors = !OK_STAT(stat,READY_STAT,BAD_STAT);
-                       
-               if (args) {
-                       struct ide_taskfile *tf = &args->tf;
+                       rq->errors = !OK_STAT(stat, READY_STAT, BAD_STAT);
+
+               if (task) {
+                       struct ide_taskfile *tf = &task->tf;
 
                        tf->error = err;
                        tf->status = stat;
 
-                       ide_tf_read(drive, args);
+                       ide_tf_read(drive, task);
+
+                       if (task->tf_flags & IDE_TFLAG_DYN)
+                               kfree(task);
                }
        } else if (blk_pm_request(rq)) {
                struct request_pm_state *pm = rq->data;
@@ -388,7 +392,8 @@ void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err)
        spin_lock_irqsave(&ide_lock, flags);
        HWGROUP(drive)->rq = NULL;
        rq->errors = err;
-       if (__blk_end_request(rq, (rq->errors ? -EIO : 0), 0))
+       if (unlikely(__blk_end_request(rq, (rq->errors ? -EIO : 0),
+                                      blk_rq_bytes(rq))))
                BUG();
        spin_unlock_irqrestore(&ide_lock, flags);
 }