Skip to content

Commit 577dfe1

Browse files
Olav Hauganwildea01
authored andcommitted
arm64/dma-mapping: Remove extraneous null-pointer checks
The current null-pointer check in __dma_alloc_coherent and __dma_free_coherent is not needed anymore since the __dma_alloc/__dma_free functions won't be called if !dev (dummy ops will be called instead). Reviewed-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Olav Haugan <ohaugan@codeaurora.org> Signed-off-by: Will Deacon <will.deacon@arm.com>
1 parent c484f25 commit 577dfe1

File tree

2 files changed

+0
-11
lines changed

2 files changed

+0
-11
lines changed

arch/arm64/include/asm/dma-mapping.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ void arch_teardown_dma_ops(struct device *dev);
4848
/* do not use this function in a driver */
4949
static inline bool is_device_dma_coherent(struct device *dev)
5050
{
51-
if (!dev)
52-
return false;
5351
return dev->archdata.dma_coherent;
5452
}
5553

arch/arm64/mm/dma-mapping.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,6 @@ static void *__dma_alloc_coherent(struct device *dev, size_t size,
9595
dma_addr_t *dma_handle, gfp_t flags,
9696
unsigned long attrs)
9797
{
98-
if (dev == NULL) {
99-
WARN_ONCE(1, "Use an actual device structure for DMA allocation\n");
100-
return NULL;
101-
}
102-
10398
if (IS_ENABLED(CONFIG_ZONE_DMA) &&
10499
dev->coherent_dma_mask <= DMA_BIT_MASK(32))
105100
flags |= GFP_DMA;
@@ -128,10 +123,6 @@ static void __dma_free_coherent(struct device *dev, size_t size,
128123
bool freed;
129124
phys_addr_t paddr = dma_to_phys(dev, dma_handle);
130125

131-
if (dev == NULL) {
132-
WARN_ONCE(1, "Use an actual device structure for DMA allocation\n");
133-
return;
134-
}
135126

136127
freed = dma_release_from_contiguous(dev,
137128
phys_to_page(paddr),

0 commit comments

Comments
 (0)