diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/swiotlb.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/swiotlb.c b/lib/swiotlb.c index 57216f3544ca..1ff8dcebf7c6 100644 --- a/lib/swiotlb.c +++ b/lib/swiotlb.c | |||
@@ -704,8 +704,9 @@ swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg, int nelems, | |||
704 | addr = SG_ENT_VIRT_ADDRESS(sg); | 704 | addr = SG_ENT_VIRT_ADDRESS(sg); |
705 | dev_addr = virt_to_phys(addr); | 705 | dev_addr = virt_to_phys(addr); |
706 | if (swiotlb_force || address_needs_mapping(hwdev, dev_addr)) { | 706 | if (swiotlb_force || address_needs_mapping(hwdev, dev_addr)) { |
707 | sg->dma_address = (dma_addr_t) virt_to_phys(map_single(hwdev, addr, sg->length, dir)); | 707 | void *map = map_single(hwdev, addr, sg->length, dir); |
708 | if (!sg->dma_address) { | 708 | sg->dma_address = virt_to_bus(map); |
709 | if (!map) { | ||
709 | /* Don't panic here, we expect map_sg users | 710 | /* Don't panic here, we expect map_sg users |
710 | to do proper error handling. */ | 711 | to do proper error handling. */ |
711 | swiotlb_full(hwdev, sg->length, dir, 0); | 712 | swiotlb_full(hwdev, sg->length, dir, 0); |