diff options
Diffstat (limited to 'lib/swiotlb.c')
| -rw-r--r-- | lib/swiotlb.c | 16 | 
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/swiotlb.c b/lib/swiotlb.c index 4abda074ea45..42e192decbfd 100644 --- a/lib/swiotlb.c +++ b/lib/swiotlb.c @@ -537,8 +537,9 @@ EXPORT_SYMBOL_GPL(swiotlb_tbl_map_single);   * Allocates bounce buffer and returns its kernel virtual address.   */ -phys_addr_t map_single(struct device *hwdev, phys_addr_t phys, size_t size, -		       enum dma_data_direction dir) +static phys_addr_t +map_single(struct device *hwdev, phys_addr_t phys, size_t size, +	   enum dma_data_direction dir)  {  	dma_addr_t start_dma_addr = phys_to_dma(hwdev, io_tlb_start); @@ -655,7 +656,7 @@ swiotlb_alloc_coherent(struct device *hwdev, size_t size,  		 */  		phys_addr_t paddr = map_single(hwdev, 0, size, DMA_FROM_DEVICE);  		if (paddr == SWIOTLB_MAP_ERROR) -			return NULL; +			goto err_warn;  		ret = phys_to_virt(paddr);  		dev_addr = phys_to_dma(hwdev, paddr); @@ -669,7 +670,7 @@ swiotlb_alloc_coherent(struct device *hwdev, size_t size,  			/* DMA_TO_DEVICE to avoid memcpy in unmap_single */  			swiotlb_tbl_unmap_single(hwdev, paddr,  						 size, DMA_TO_DEVICE); -			return NULL; +			goto err_warn;  		}  	} @@ -677,6 +678,13 @@ swiotlb_alloc_coherent(struct device *hwdev, size_t size,  	memset(ret, 0, size);  	return ret; + +err_warn: +	pr_warn("swiotlb: coherent allocation failed for device %s size=%zu\n", +		dev_name(hwdev), size); +	dump_stack(); + +	return NULL;  }  EXPORT_SYMBOL(swiotlb_alloc_coherent);  |