diff options
-rw-r--r-- | lib/swiotlb.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/swiotlb.c b/lib/swiotlb.c index 3c365ab6cf5f..42e192decbfd 100644 --- a/lib/swiotlb.c +++ b/lib/swiotlb.c | |||
@@ -656,7 +656,7 @@ swiotlb_alloc_coherent(struct device *hwdev, size_t size, | |||
656 | */ | 656 | */ |
657 | phys_addr_t paddr = map_single(hwdev, 0, size, DMA_FROM_DEVICE); | 657 | phys_addr_t paddr = map_single(hwdev, 0, size, DMA_FROM_DEVICE); |
658 | if (paddr == SWIOTLB_MAP_ERROR) | 658 | if (paddr == SWIOTLB_MAP_ERROR) |
659 | return NULL; | 659 | goto err_warn; |
660 | 660 | ||
661 | ret = phys_to_virt(paddr); | 661 | ret = phys_to_virt(paddr); |
662 | dev_addr = phys_to_dma(hwdev, paddr); | 662 | dev_addr = phys_to_dma(hwdev, paddr); |
@@ -670,7 +670,7 @@ swiotlb_alloc_coherent(struct device *hwdev, size_t size, | |||
670 | /* DMA_TO_DEVICE to avoid memcpy in unmap_single */ | 670 | /* DMA_TO_DEVICE to avoid memcpy in unmap_single */ |
671 | swiotlb_tbl_unmap_single(hwdev, paddr, | 671 | swiotlb_tbl_unmap_single(hwdev, paddr, |
672 | size, DMA_TO_DEVICE); | 672 | size, DMA_TO_DEVICE); |
673 | return NULL; | 673 | goto err_warn; |
674 | } | 674 | } |
675 | } | 675 | } |
676 | 676 | ||
@@ -678,6 +678,13 @@ swiotlb_alloc_coherent(struct device *hwdev, size_t size, | |||
678 | memset(ret, 0, size); | 678 | memset(ret, 0, size); |
679 | 679 | ||
680 | return ret; | 680 | return ret; |
681 | |||
682 | err_warn: | ||
683 | pr_warn("swiotlb: coherent allocation failed for device %s size=%zu\n", | ||
684 | dev_name(hwdev), size); | ||
685 | dump_stack(); | ||
686 | |||
687 | return NULL; | ||
681 | } | 688 | } |
682 | EXPORT_SYMBOL(swiotlb_alloc_coherent); | 689 | EXPORT_SYMBOL(swiotlb_alloc_coherent); |
683 | 690 | ||