Skip to contentSkip to conversation

MIPS: Netlogic: Fix build error

PATCH Superseded Guenter Roeck 1 participant 2 messages Aug 25, 2015 MIPS

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MIPS: Netlogic: Fix build error

dma_alloc_from_coherent is defined as (0) if HAVE_GENERIC_DMA_COHERENT is not configured. This results in the following build error, seen with nlm_xlp_defconfig.

arch/mips/netlogic/common/nlm-dma.c: In function 'nlm_dma_alloc_coherent':
arch/mips/netlogic/common/nlm-dma.c:50:8: error: unused variable 'ret'

Add __maybe_unused to the variable declaration to fix the problem.

Fixes 79f8511c83f1 ("MIPS: Netlogic: SWIOTLB dma ops for 32-bit DMA")
Cc Jayachandran C <[email protected]>
Cc Ganesan Ramalingam <[email protected]>
---
 arch/mips/netlogic/common/nlm-dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/netlogic/common/nlm-dma.c +1 -1
index f3d4ae87abc7..4982d97d279f 100644
@@ -47,7 +47,7 @@ static char *nlm_swiotlb;
 static void *nlm_dma_alloc_coherent(struct device *dev, size_t size,
 	dma_addr_t *dma_handle, gfp_t gfp, struct dma_attrs *attrs)
 {
-	void *ret;
+	void __maybe_unused *ret;
 
 	if (dma_alloc_from_coherent(dev, size, dma_handle, &ret))
 		return ret;
Signature · 1 line
2.1.4
#1 lore raw
Quoted 10 lines · Guenter Roeck

dma_alloc_from_coherent is defined as (0) if HAVE_GENERIC_DMA_COHERENT is not configured. This results in the following build error, seen with nlm_xlp_defconfig.

arch/mips/netlogic/common/nlm-dma.c: In function 'nlm_dma_alloc_coherent':
arch/mips/netlogic/common/nlm-dma.c:50:8: error: unused variable 'ret'

Add __maybe_unused to the variable declaration to fix the problem.

Fixes 79f8511c83f1 ("MIPS: Netlogic: SWIOTLB dma ops for 32-bit DMA")

Upon reflection, I think the problem may have been introduced by changes in the definition of dma_alloc_from_coherent(), not by the above patch. Not sure how to fix that properly.

Guenter

Quoted 21 lines
Cc Jayachandran C <[email protected]>
Cc Ganesan Ramalingam <[email protected]>
---
  arch/mips/netlogic/common/nlm-dma.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/netlogic/common/nlm-dma.c +1 -1
index f3d4ae87abc7..4982d97d279f 100644
@@ -47,7 +47,7 @@ static char *nlm_swiotlb;
  static void *nlm_dma_alloc_coherent(struct device *dev, size_t size,
  	dma_addr_t *dma_handle, gfp_t gfp, struct dma_attrs *attrs)
  {
-	void *ret;
+	void __maybe_unused *ret;
 
  	if (dma_alloc_from_coherent(dev, size, dma_handle, &ret))
  		return ret;