Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1665182 > unrolled thread

[PATCH v2] arm64/dma-mapping: Remove extraneous null-pointer checks

Started byOlav Haugan <ohaugan@codeaurora.org>
First post2017-06-13 23:00 +0200
Last post2017-06-14 14:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2] arm64/dma-mapping: Remove extraneous null-pointer checks Olav Haugan <ohaugan@codeaurora.org> - 2017-06-13 23:00 +0200
    Re: [PATCH v2] arm64/dma-mapping: Remove extraneous null-pointer  checks Catalin Marinas <catalin.marinas@arm.com> - 2017-06-14 14:40 +0200

#1665182 — [PATCH v2] arm64/dma-mapping: Remove extraneous null-pointer checks

FromOlav Haugan <ohaugan@codeaurora.org>
Date2017-06-13 23:00 +0200
Subject[PATCH v2] arm64/dma-mapping: Remove extraneous null-pointer checks
Message-ID<tS14S-4hr-19@gated-at.bofh.it>
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 <ohaugan@codeaurora.org>
---
 arch/arm64/include/asm/dma-mapping.h | 2 --
 arch/arm64/mm/dma-mapping.c          | 9 ---------
 2 files changed, 11 deletions(-)

diff --git a/arch/arm64/include/asm/dma-mapping.h b/arch/arm64/include/asm/dma-mapping.h
index 5392dbeffa45..f72779aad276 100644
--- a/arch/arm64/include/asm/dma-mapping.h
+++ b/arch/arm64/include/asm/dma-mapping.h
@@ -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;
 }
 
diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
index 3216e098c058..3e340b625436 100644
--- a/arch/arm64/mm/dma-mapping.c
+++ b/arch/arm64/mm/dma-mapping.c
@@ -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),
-- 
2.13.0

[toc] | [next] | [standalone]


#1665753 — Re: [PATCH v2] arm64/dma-mapping: Remove extraneous null-pointer checks

FromCatalin Marinas <catalin.marinas@arm.com>
Date2017-06-14 14:40 +0200
SubjectRe: [PATCH v2] arm64/dma-mapping: Remove extraneous null-pointer checks
Message-ID<tSfKx-5an-9@gated-at.bofh.it>
In reply to#1665182
On Tue, Jun 13, 2017 at 01:56:14PM -0700, Olav Haugan wrote:
> 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 <ohaugan@codeaurora.org>
> ---
>  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 <catalin.marinas@arm.com>

Will should pick this up for 4.13

-- 
Catalin

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web