]> nv-tegra.nvidia Code Review - linux-2.6.git/commitdiff
[PATCH] libata: kill NULL qc handling from ->eng_timeout callbacks
authorTejun Heo <htejun@gmail.com>
Fri, 10 Feb 2006 06:10:48 +0000 (15:10 +0900)
committerJeff Garzik <jgarzik@pobox.com>
Fri, 10 Feb 2006 11:50:47 +0000 (06:50 -0500)
->eng_timeout cannot be invoked with NULL qc anymore.  Add an
assertion in ata_scsi_error() and kill NULL qc handling from all
->eng_timeout callbacks.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
drivers/scsi/ahci.c
drivers/scsi/libata-core.c
drivers/scsi/libata-scsi.c
drivers/scsi/sata_mv.c
drivers/scsi/sata_promise.c
drivers/scsi/sata_sil24.c
drivers/scsi/sata_sx4.c

index c67189a4e0b1cfcad607601b11f944d86f824e2e..fa01894fc41b90d297c4ba70693e79a6ff5bac53 100644 (file)
@@ -677,19 +677,13 @@ static void ahci_eng_timeout(struct ata_port *ap)
 
        spin_lock_irqsave(&host_set->lock, flags);
 
+       ahci_restart_port(ap, readl(port_mmio + PORT_IRQ_STAT));
        qc = ata_qc_from_tag(ap, ap->active_tag);
-       if (!qc) {
-               printk(KERN_ERR "ata%u: BUG: timeout without command\n",
-                      ap->id);
-       } else {
-               ahci_restart_port(ap, readl(port_mmio + PORT_IRQ_STAT));
-               qc->err_mask |= AC_ERR_TIMEOUT;
-       }
+       qc->err_mask |= AC_ERR_TIMEOUT;
 
        spin_unlock_irqrestore(&host_set->lock, flags);
 
-       if (qc)
-               ata_eh_qc_complete(qc);
+       ata_eh_qc_complete(qc);
 }
 
 static inline int ahci_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc)
index d53e0bce2bec5c79fb441c7994d9c08323bc9a2f..b938c7a37664779f2b958be8fde7b420885179a9 100644 (file)
@@ -3524,20 +3524,10 @@ static void ata_qc_timeout(struct ata_queued_cmd *qc)
 
 void ata_eng_timeout(struct ata_port *ap)
 {
-       struct ata_queued_cmd *qc;
-
        DPRINTK("ENTER\n");
 
-       qc = ata_qc_from_tag(ap, ap->active_tag);
-       if (qc)
-               ata_qc_timeout(qc);
-       else {
-               printk(KERN_ERR "ata%u: BUG: timeout without command\n",
-                      ap->id);
-               goto out;
-       }
+       ata_qc_timeout(ata_qc_from_tag(ap, ap->active_tag));
 
-out:
        DPRINTK("EXIT\n");
 }
 
index d67cc2fb56948090c6c1a6c373d6e5f32e58150b..9d67c6768335689747a3b8663092a9da0cb6c437 100644 (file)
@@ -782,6 +782,7 @@ int ata_scsi_error(struct Scsi_Host *host)
        spin_lock_irqsave(&ap->host_set->lock, flags);
        assert(!(ap->flags & ATA_FLAG_IN_EH));
        ap->flags |= ATA_FLAG_IN_EH;
+       assert(ata_qc_from_tag(ap, ap->active_tag) != NULL);
        spin_unlock_irqrestore(&ap->host_set->lock, flags);
 
        ap->ops->eng_timeout(ap);
index 1db05f23f12f061a5cabed561d24e8bb561c6ae4..6c80527ddd218f13cd4c95a343ed8a58dc7e4ed0 100644 (file)
@@ -2027,13 +2027,8 @@ static void mv_eng_timeout(struct ata_port *ap)
        mv_err_intr(ap);
        mv_stop_and_reset(ap);
 
-       if (!qc) {
-               printk(KERN_ERR "ata%u: BUG: timeout without command\n",
-                      ap->id);
-       } else {
-               qc->err_mask |= AC_ERR_TIMEOUT;
-               ata_eh_qc_complete(qc);
-       }
+       qc->err_mask |= AC_ERR_TIMEOUT;
+       ata_eh_qc_complete(qc);
 }
 
 /**
index 5d4ed54d9452734f0d68169a5ecca1b3c1b8b419..c9dfd93709199cca357930338b36a573b5b0423d 100644 (file)
@@ -432,11 +432,6 @@ static void pdc_eng_timeout(struct ata_port *ap)
        spin_lock_irqsave(&host_set->lock, flags);
 
        qc = ata_qc_from_tag(ap, ap->active_tag);
-       if (!qc) {
-               printk(KERN_ERR "ata%u: BUG: timeout without command\n",
-                      ap->id);
-               goto out;
-       }
 
        switch (qc->tf.protocol) {
        case ATA_PROT_DMA:
@@ -456,10 +451,8 @@ static void pdc_eng_timeout(struct ata_port *ap)
                break;
        }
 
-out:
        spin_unlock_irqrestore(&host_set->lock, flags);
-       if (qc)
-               ata_eh_qc_complete(qc);
+       ata_eh_qc_complete(qc);
        DPRINTK("EXIT\n");
 }
 
index f4742ad3c962684dc811827bf2b26be77d18766a..962396b36f611fbf68b19fbcffc879bc71c47f0b 100644 (file)
@@ -639,11 +639,6 @@ static void sil24_eng_timeout(struct ata_port *ap)
        struct ata_queued_cmd *qc;
 
        qc = ata_qc_from_tag(ap, ap->active_tag);
-       if (!qc) {
-               printk(KERN_ERR "ata%u: BUG: timeout without command\n",
-                      ap->id);
-               return;
-       }
 
        printk(KERN_ERR "ata%u: command timeout\n", ap->id);
        qc->err_mask |= AC_ERR_TIMEOUT;
index 3319f03b61a0c1fddc938607ab4c68d5af2e7b92..212cff4fe5f51ee2f7a4caad299a2f64b8876bce 100644 (file)
@@ -867,11 +867,6 @@ static void pdc_eng_timeout(struct ata_port *ap)
        spin_lock_irqsave(&host_set->lock, flags);
 
        qc = ata_qc_from_tag(ap, ap->active_tag);
-       if (!qc) {
-               printk(KERN_ERR "ata%u: BUG: timeout without command\n",
-                      ap->id);
-               goto out;
-       }
 
        switch (qc->tf.protocol) {
        case ATA_PROT_DMA:
@@ -890,10 +885,8 @@ static void pdc_eng_timeout(struct ata_port *ap)
                break;
        }
 
-out:
        spin_unlock_irqrestore(&host_set->lock, flags);
-       if (qc)
-               ata_eh_qc_complete(qc);
+       ata_eh_qc_complete(qc);
        DPRINTK("EXIT\n");
 }