diff options
Diffstat (limited to 'lib/swiotlb.c')
| -rw-r--r-- | lib/swiotlb.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/swiotlb.c b/lib/swiotlb.c index 795472d8ae24..437eedb5a53b 100644 --- a/lib/swiotlb.c +++ b/lib/swiotlb.c | |||
| @@ -485,7 +485,7 @@ do_unmap_single(struct device *hwdev, char *dma_addr, size_t size, int dir) | |||
| 485 | 485 | ||
| 486 | /* | 486 | /* |
| 487 | * Return the buffer to the free list by setting the corresponding | 487 | * Return the buffer to the free list by setting the corresponding |
| 488 | * entries to indicate the number of contigous entries available. | 488 | * entries to indicate the number of contiguous entries available. |
| 489 | * While returning the entries to the free list, we merge the entries | 489 | * While returning the entries to the free list, we merge the entries |
| 490 | * with slots below and above the pool being returned. | 490 | * with slots below and above the pool being returned. |
| 491 | */ | 491 | */ |
| @@ -549,7 +549,7 @@ swiotlb_alloc_coherent(struct device *hwdev, size_t size, | |||
| 549 | dma_mask = hwdev->coherent_dma_mask; | 549 | dma_mask = hwdev->coherent_dma_mask; |
| 550 | 550 | ||
| 551 | ret = (void *)__get_free_pages(flags, order); | 551 | ret = (void *)__get_free_pages(flags, order); |
| 552 | if (ret && swiotlb_virt_to_bus(hwdev, ret) + size > dma_mask) { | 552 | if (ret && swiotlb_virt_to_bus(hwdev, ret) + size - 1 > dma_mask) { |
| 553 | /* | 553 | /* |
| 554 | * The allocated memory isn't reachable by the device. | 554 | * The allocated memory isn't reachable by the device. |
| 555 | */ | 555 | */ |
| @@ -571,7 +571,7 @@ swiotlb_alloc_coherent(struct device *hwdev, size_t size, | |||
| 571 | dev_addr = swiotlb_virt_to_bus(hwdev, ret); | 571 | dev_addr = swiotlb_virt_to_bus(hwdev, ret); |
| 572 | 572 | ||
| 573 | /* Confirm address can be DMA'd by device */ | 573 | /* Confirm address can be DMA'd by device */ |
| 574 | if (dev_addr + size > dma_mask) { | 574 | if (dev_addr + size - 1 > dma_mask) { |
| 575 | printk("hwdev DMA mask = 0x%016Lx, dev_addr = 0x%016Lx\n", | 575 | printk("hwdev DMA mask = 0x%016Lx, dev_addr = 0x%016Lx\n", |
| 576 | (unsigned long long)dma_mask, | 576 | (unsigned long long)dma_mask, |
| 577 | (unsigned long long)dev_addr); | 577 | (unsigned long long)dev_addr); |
