Skip to contentSkip to conversation

MIPS: Fix OCTEON BUG() warnings a different way.

PATCH In review David Daney 2 participants 2 messages Jun 19, 2013 – Jun 20, 2013 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MIPS: Fix OCTEON BUG() warnings a different way.

From: David Daney <[email protected]>

---
 arch/mips/include/asm/mach-cavium-octeon/dma-coherence.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
arch/mips/include/asm/mach-cavium-octeon/dma-coherence.h +5 -5
index 840399b..3531963 100644
@@ -24,21 +24,21 @@ static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr,
 	size_t size)
 {
 	BUG();
-	unreachable();
+	return 0;
 }
 
 static inline dma_addr_t plat_map_dma_mem_page(struct device *dev,
 	struct page *page)
 {
 	BUG();
-	unreachable();
+	return 0;
 }
 
 static inline unsigned long plat_dma_addr_to_phys(struct device *dev,
 	dma_addr_t dma_addr)
 {
 	BUG();
-	unreachable();
+	return 0;
 }
 
 static inline void plat_unmap_dma_mem(struct device *dev, dma_addr_t dma_addr,
@@ -50,7 +50,7 @@ static inline void plat_unmap_dma_mem(struct device *dev, dma_addr_t dma_addr,
 static inline int plat_dma_supported(struct device *dev, u64 mask)
 {
 	BUG();
-	unreachable();
+	return 0;
 }
 
 static inline void plat_extra_sync_for_device(struct device *dev)
@@ -67,7 +67,7 @@ static inline int plat_dma_mapping_error(struct device *dev,
 					 dma_addr_t dma_addr)
 {
 	BUG();
-	unreachable();
+	return 0;
 }
 
 dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr);
Signature · 1 line
1.7.11.7
#1 lore raw
Quoted 1 line · David Daney

I replaced my fix with your fix but left he direct inclusion of <linux/bug.h>.

Let as homework for a later point: make BUG() invoke unreachable() if CONFIG_BUG is diabled, something like that. This will improve code generation for GCC 4.5+ but for older compilers unreachable() is defined as do { } while (1) so will emit extra code.

Thanks,

Ralf