Skip to content

Commit

Permalink
swiotlb: fail map correctly with failed io_tlb_default_mem
Browse files Browse the repository at this point in the history
In the failure case of trying to use a buffer which we'd previously
failed to allocate, the "!mem" condition is no longer sufficient since
io_tlb_default_mem became static and assigned by default. Update the
condition to work as intended per the rest of that conversion.

Fixes: 463e862 ("swiotlb: Convert io_default_tlb_mem to static allocation")
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
  • Loading branch information
Robin Murphy authored and Christoph Hellwig committed Jul 12, 2022
1 parent 4136ce9 commit c51ba24
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/dma/swiotlb.c
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ phys_addr_t swiotlb_tbl_map_single(struct device *dev, phys_addr_t orig_addr,
int index;
phys_addr_t tlb_addr;

if (!mem)
if (!mem || !mem->nslabs)
panic("Can not allocate SWIOTLB buffer earlier and can't now provide you with the DMA bounce buffer");

if (cc_platform_has(CC_ATTR_MEM_ENCRYPT))
Expand Down

0 comments on commit c51ba24

Please sign in to comment.