aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2006-02-10 01:10:48 -0500
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 c67189a4e0b1..fa01894fc41b 100644
--- a/drivers/scsi/ahci.c
+++ b/drivers/scsi/ahci.c
@@ -677,19 +677,13 @@ static void ahci_eng_timeout(struct ata_port *ap)
677 677
678 spin_lock_irqsave(&host_set->lock, flags); 678 spin_lock_irqsave(&host_set->lock, flags);
679 679
680 ahci_restart_port(ap, readl(port_mmio + PORT_IRQ_STAT));
680 qc = ata_qc_from_tag(ap, ap->active_tag); 681 qc = ata_qc_from_tag(ap, ap->active_tag);
681 if (!qc) { 682 qc->err_mask |= AC_ERR_TIMEOUT;
682 printk(KERN_ERR "ata%u: BUG: timeout without command\n",
683 ap->id);
684 } else {
685 ahci_restart_port(ap, readl(port_mmio + PORT_IRQ_STAT));
686 qc->err_mask |= AC_ERR_TIMEOUT;
687 }
688 683
689 spin_unlock_irqrestore(&host_set->lock, flags); 684 spin_unlock_irqrestore(&host_set->lock, flags);
690 685
691 if (qc) 686 ata_eh_qc_complete(qc);
692 ata_eh_qc_complete(qc);
693} 687}
694 688
695static inline int ahci_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc) 689static 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 d53e0bce2bec..b938c7a37664 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)
3524 3524
3525void ata_eng_timeout(struct ata_port *ap) 3525void ata_eng_timeout(struct ata_port *ap)
3526{ 3526{
3527 struct ata_queued_cmd *qc;
3528
3529 DPRINTK("ENTER\n"); 3527 DPRINTK("ENTER\n");
3530 3528
3531 qc = ata_qc_from_tag(ap, ap->active_tag); 3529 ata_qc_timeout(ata_qc_from_tag(ap, ap->active_tag));
3532 if (qc)
3533 ata_qc_timeout(qc);
3534 else {
3535 printk(KERN_ERR "ata%u: BUG: timeout without command\n",
3536 ap->id);
3537 goto out;
3538 }
3539 3530
3540out:
3541 DPRINTK("EXIT\n"); 3531 DPRINTK("EXIT\n");
3542} 3532}
3543 3533
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index d67cc2fb5694..9d67c6768335 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)
782 spin_lock_irqsave(&ap->host_set->lock, flags); 782 spin_lock_irqsave(&ap->host_set->lock, flags);
783 assert(!(ap->flags & ATA_FLAG_IN_EH)); 783 assert(!(ap->flags & ATA_FLAG_IN_EH));
784 ap->flags |= ATA_FLAG_IN_EH; 784 ap->flags |= ATA_FLAG_IN_EH;
785 assert(ata_qc_from_tag(ap, ap->active_tag) != NULL);
785 spin_unlock_irqrestore(&ap->host_set->lock, flags); 786 spin_unlock_irqrestore(&ap->host_set->lock, flags);
786 787
787 ap->ops->eng_timeout(ap); 788 ap->ops->eng_timeout(ap);
diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c
index 1db05f23f12f..6c80527ddd21 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)
2027 mv_err_intr(ap); 2027 mv_err_intr(ap);
2028 mv_stop_and_reset(ap); 2028 mv_stop_and_reset(ap);
2029 2029
2030 if (!qc) { 2030 qc->err_mask |= AC_ERR_TIMEOUT;
2031 printk(KERN_ERR "ata%u: BUG: timeout without command\n", 2031 ata_eh_qc_complete(qc);
2032 ap->id);
2033 } else {
2034 qc->err_mask |= AC_ERR_TIMEOUT;
2035 ata_eh_qc_complete(qc);
2036 }
2037} 2032}
2038 2033
2039/** 2034/**
diff --git a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c
index 5d4ed54d9452..c9dfd9370919 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)
432 spin_lock_irqsave(&host_set->lock, flags); 432 spin_lock_irqsave(&host_set->lock, flags);
433 433
434 qc = ata_qc_from_tag(ap, ap->active_tag); 434 qc = ata_qc_from_tag(ap, ap->active_tag);
435 if (!qc) {
436 printk(KERN_ERR "ata%u: BUG: timeout without command\n",
437 ap->id);
438 goto out;
439 }
440 435
441 switch (qc->tf.protocol) { 436 switch (qc->tf.protocol) {
442 case ATA_PROT_DMA: 437 case ATA_PROT_DMA:
@@ -456,10 +451,8 @@ static void pdc_eng_timeout(struct ata_port *ap)
456 break; 451 break;
457 } 452 }
458 453
459out:
460 spin_unlock_irqrestore(&host_set->lock, flags); 454 spin_unlock_irqrestore(&host_set->lock, flags);
461 if (qc) 455 ata_eh_qc_complete(qc);
462 ata_eh_qc_complete(qc);
463 DPRINTK("EXIT\n"); 456 DPRINTK("EXIT\n");
464} 457}
465 458
diff --git a/drivers/scsi/sata_sil24.c b/drivers/scsi/sata_sil24.c
index f4742ad3c962..962396b36f61 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)
639 struct ata_queued_cmd *qc; 639 struct ata_queued_cmd *qc;
640 640
641 qc = ata_qc_from_tag(ap, ap->active_tag); 641 qc = ata_qc_from_tag(ap, ap->active_tag);
642 if (!qc) {
643 printk(KERN_ERR "ata%u: BUG: timeout without command\n",
644 ap->id);
645 return;
646 }
647 642
648 printk(KERN_ERR "ata%u: command timeout\n", ap->id); 643 printk(KERN_ERR "ata%u: command timeout\n", ap->id);
649 qc->err_mask |= AC_ERR_TIMEOUT; 644 qc->err_mask |= AC_ERR_TIMEOUT;
diff --git a/drivers/scsi/sata_sx4.c b/drivers/scsi/sata_sx4.c
index 3319f03b61a0..212cff4fe5f5 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)
867 spin_lock_irqsave(&host_set->lock, flags); 867 spin_lock_irqsave(&host_set->lock, flags);
868 868
869 qc = ata_qc_from_tag(ap, ap->active_tag); 869 qc = ata_qc_from_tag(ap, ap->active_tag);
870 if (!qc) {
871 printk(KERN_ERR "ata%u: BUG: timeout without command\n",
872 ap->id);
873 goto out;
874 }
875 870
876 switch (qc->tf.protocol) { 871 switch (qc->tf.protocol) {
877 case ATA_PROT_DMA: 872 case ATA_PROT_DMA:
@@ -890,10 +885,8 @@ static void pdc_eng_timeout(struct ata_port *ap)
890 break; 885 break;
891 } 886 }
892 887
893out:
894 spin_unlock_irqrestore(&host_set->lock, flags); 888 spin_unlock_irqrestore(&host_set->lock, flags);
895 if (qc) 889 ata_eh_qc_complete(qc);
896 ata_eh_qc_complete(qc);
897 DPRINTK("EXIT\n"); 890 DPRINTK("EXIT\n");
898} 891}
899 892