From: Jeff Garzik Date: Wed, 22 Mar 2006 02:31:22 +0000 (-0500) Subject: [libata] fix oops on non-DMA bmdma hardware X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=4d4681f6b994baf93dff0e4f59ab4fe38b49ef13;p=openwrt%2Fstaging%2Fblogic.git [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 --- 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) void ata_bmdma_irq_clear(struct ata_port *ap) { - if (ap->flags & ATA_FLAG_MMIO) { - void __iomem *mmio = ((void __iomem *) ap->ioaddr.bmdma_addr) + ATA_DMA_STATUS; - writeb(readb(mmio), mmio); - } else { - unsigned long addr = ap->ioaddr.bmdma_addr + ATA_DMA_STATUS; - outb(inb(addr), addr); - } + if (!ap->ioaddr.bmdma_addr) + return; + if (ap->flags & ATA_FLAG_MMIO) { + void __iomem *mmio = + ((void __iomem *) ap->ioaddr.bmdma_addr) + ATA_DMA_STATUS; + writeb(readb(mmio), mmio); + } else { + unsigned long addr = ap->ioaddr.bmdma_addr + ATA_DMA_STATUS; + outb(inb(addr), addr); + } }