aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2006-02-10 15:10:48 +0900
committerJeff Garzik <jgarzik@pobox.com>2006-02-10 06:50:47 -0500
commitf63790201521ccadb63673ff121dac46ab300cf0 (patch)
tree86781b4efc31f9005c17de63df2606c35ae3b0c0 /drivers
parent35daeb8f9b41fd13180e8a6f8bec9fc5268938f9 (diff)
[PATCH] libata: kill NULL qc handling from ->eng_timeout callbacks
->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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/ahci.c12
-rw-r--r--drivers/scsi/libata-core.c12
-rw-r--r--drivers/scsi/libata-scsi.c1
-rw-r--r--drivers/scsi/sata_mv.c9
-rw-r--r--drivers/scsi/sata_promise.c9
-rw-r--r--drivers/scsi/sata_sil24.c5
-rw-r--r--drivers/scsi/sata_sx4.c9
7 files changed, 9 insertions, 48 deletions
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c
index c67189a4e0b..fa01894fc41 100644
--- a/drivers/scsi/ahci.c
+++ b/drivers/scsi/ahci.c
@@ -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)
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index d53e0bce2be..b938c7a3766 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -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");
}
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index d67cc2fb569..9d67c676833 100644
--- a/drivers/scsi/libata-scsi.c
+++ b/drivers/scsi/libata-scsi.c
@@ -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);
diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c
index 1db05f23f12..6c80527ddd2 100644
--- a/drivers/scsi/sata_mv.c
+++ b/drivers/scsi/sata_mv.c
@@ -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);
}
/**
diff --git a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c
index 5d4ed54d945..c9dfd937091 100644
--- a/drivers/scsi/sata_promise.c
+++ b/drivers/scsi/sata_promise.c
@@ -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");
}
diff --git a/drivers/scsi/sata_sil24.c b/drivers/scsi/sata_sil24.c
index f4742ad3c96..962396b36f6 100644
--- a/drivers/scsi/sata_sil24.c
+++ b/drivers/scsi/sata_sil24.c
@@ -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;
diff --git a/drivers/scsi/sata_sx4.c b/drivers/scsi/sata_sx4.c
index 3319f03b61a..212cff4fe5f 100644
--- a/drivers/scsi/sata_sx4.c
+++ b/drivers/scsi/sata_sx4.c
@@ -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");
}