From: James Bottomley Date: Fri, 18 Nov 2005 22:13:33 +0000 (+0100) Subject: [PATCH] ide: fix ide_toggle_bounce() to not try to bounce if we have an IOMMU X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6593178dd46d64a5bcb0402a4f3acd95b0687abd;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [PATCH] ide: fix ide_toggle_bounce() to not try to bounce if we have an IOMMU The following patch fixes a crash caused by attempting to bounce buffer when an IDE CD-ROM is used on a machine with an IO-MMU. [At least, this patch fixes things so I can use my IDE CD-ROM behind an ns87415 on a HP PA-RISC workstation.] Signed-off-by: James Bottomley Signed-off-by: Kyle McMartin Signed-off-by: Bartlomiej Zolnierkiewicz --- diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c index b09a6537c7a8..41d46dbe6c24 100644 --- a/drivers/ide/ide-lib.c +++ b/drivers/ide/ide-lib.c @@ -410,10 +410,10 @@ void ide_toggle_bounce(ide_drive_t *drive, int on) { u64 addr = BLK_BOUNCE_HIGH; /* dma64_addr_t */ - if (on && drive->media == ide_disk) { - if (!PCI_DMA_BUS_IS_PHYS) - addr = BLK_BOUNCE_ANY; - else if (HWIF(drive)->pci_dev) + if (!PCI_DMA_BUS_IS_PHYS) { + addr = BLK_BOUNCE_ANY; + } else if (on && drive->media == ide_disk) { + if (HWIF(drive)->pci_dev) addr = HWIF(drive)->pci_dev->dma_mask; }