arm64/dma-mapping: Remove extraneous null-pointer checks
PATCH v2 1/1 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).
Signed-off-by Olav Haugan <[email protected]>
--- arch/arm64/include/asm/dma-mapping.h | 2 -- arch/arm64/mm/dma-mapping.c | 9 --------- 2 files changed, 11 deletions(-)
arch/arm64/include/asm/dma-mapping.h +0 -2
@@ -48,8 +48,6 @@ void arch_teardown_dma_ops(struct device *dev);/* do not use this function in a driver */ static inline bool is_device_dma_coherent (struct device *dev) { -if (!dev) -return false;return dev->archdata.dma_coherent; }
arch/arm64/mm/dma-mapping.c +0 -9
@@ -95,11 +95,6 @@ static void *__dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t flags, unsigned long attrs) { - if (dev == NULL) { - WARN_ONCE(1, "Use an actual device structure for DMA allocation\n"); -return NULL ; - } - if (IS_ENABLED(CONFIG_ZONE_DMA) && dev->coherent_dma_mask <= DMA_BIT_MASK(32)) flags |= GFP_DMA;
@@ -128,10 +123,6 @@ static void __dma_free_coherent(struct device *dev, size_t size,bool freed;phys_addr_t paddr =dma_to_phys (dev, dma_handle); -if (dev ==NULL ) { -WARN_ONCE (1 ,"Use an actual device structure for DMA allocation\n" ); -return ; - } freed = dma_release_from_contiguous(dev, phys_to_page(paddr),
Signature · 1 line
2.13.0
Quoted 10 lines · Olav Haugan
The current null-pointer check in
__dma_alloc_coherentand__dma_free_coherentis not needed anymore since the __dma_alloc/__dma_free functions won't be called if !dev (dummy ops will be called instead).Signed-off-by Olav Haugan <[email protected]>--- arch/arm64/include/asm/dma-mapping.h | 2 -- arch/arm64/mm/dma-mapping.c | 9 --------- 2 files changed, 11 deletions(-)
Thanks.
Reviewed-by Catalin Marinas <[email protected]>
Will should pick this up for 4.13
Signature · 1 line
Catalin