aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2006-03-21 21:31:22 -0500
committerJeff Garzik <jeff@garzik.org>2006-03-21 21:31:22 -0500
commit4d4681f6b994baf93dff0e4f59ab4fe38b49ef13 (patch)
treeb45ce12c0b6a4561ccba3f6327d98aa5af864c2a
parent17bb34a3c548c4fd2a7c859123a631f97c2af09f (diff)
[libata] fix oops on non-DMA bmdma hardware
Alan noted: "bmdma may be zero but the bmdma_irq_clear function gets called even in this case during pure PIO operation. Check we have a bmdma before we use it." I fixed this by adding a check for zero. While was I there, I fixed the non-standard indentation of the small function's code. Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r--drivers/scsi/libata-core.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index 673ddf611d0e..c8d2201b126f 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -4202,14 +4202,17 @@ void ata_bmdma_setup(struct ata_queued_cmd *qc)
4202 4202
4203void ata_bmdma_irq_clear(struct ata_port *ap) 4203void ata_bmdma_irq_clear(struct ata_port *ap)
4204{ 4204{
4205 if (ap->flags & ATA_FLAG_MMIO) { 4205 if (!ap->ioaddr.bmdma_addr)
4206 void __iomem *mmio = ((void __iomem *) ap->ioaddr.bmdma_addr) + ATA_DMA_STATUS; 4206 return;
4207 writeb(readb(mmio), mmio);
4208 } else {
4209 unsigned long addr = ap->ioaddr.bmdma_addr + ATA_DMA_STATUS;
4210 outb(inb(addr), addr);
4211 }
4212 4207
4208 if (ap->flags & ATA_FLAG_MMIO) {
4209 void __iomem *mmio =
4210 ((void __iomem *) ap->ioaddr.bmdma_addr) + ATA_DMA_STATUS;
4211 writeb(readb(mmio), mmio);
4212 } else {
4213 unsigned long addr = ap->ioaddr.bmdma_addr + ATA_DMA_STATUS;
4214 outb(inb(addr), addr);
4215 }
4213} 4216}
4214 4217
4215 4218