Skip to content

Commit a9c38c5

Browse files
rpptwilldeacon
authored andcommitted
dma-mapping: remove bogus test for pfn_valid from dma_map_resource
dma_map_resource() uses pfn_valid() to ensure the range is not RAM. However, pfn_valid() only checks for availability of the memory map for a PFN but it does not ensure that the PFN is actually backed by RAM. As dma_map_resource() is the only method in DMA mapping APIs that has this check, simply drop the pfn_valid() test from dma_map_resource(). Link: https://lore.kernel.org/all/[email protected]/ Signed-off-by: Mike Rapoport <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Acked-by: David Hildenbrand <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 5816b3e commit a9c38c5

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

kernel/dma/mapping.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -296,10 +296,6 @@ dma_addr_t dma_map_resource(struct device *dev, phys_addr_t phys_addr,
296296
if (WARN_ON_ONCE(!dev->dma_mask))
297297
return DMA_MAPPING_ERROR;
298298

299-
/* Don't allow RAM to be mapped */
300-
if (WARN_ON_ONCE(pfn_valid(PHYS_PFN(phys_addr))))
301-
return DMA_MAPPING_ERROR;
302-
303299
if (dma_map_direct(dev, ops))
304300
addr = dma_direct_map_resource(dev, phys_addr, size, dir, attrs);
305301
else if (ops->map_resource)

0 commit comments

Comments
 (0)