Skip to content

Commit

Permalink
[libata] fix oops on non-DMA bmdma hardware
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jeff Garzik committed Mar 22, 2006
1 parent 17bb34a commit 4d4681f
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions drivers/scsi/libata-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}


Expand Down

0 comments on commit 4d4681f

Please sign in to comment.