Skip to contentSkip to conversation

More unreachable() conversions.

PATCH In review David Daney 4 participants 11 messages Dec 10, 2009 – Dec 11, 2009

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover More unreachable() conversions.

Back in commit 38938c879eb0c39edf85d5164aa0cffe2874304c the new macro unreachable() was added. We can use it in BUG instead of a variety of ad hoc endless loops.

This patch set consists of the patches from the original set that were never Acked-by anyone. Although they are completely untested, they seem plausible.

I don't plan on pushing these things out any more, so if you like them please merge them via your architecture trees.

I will reply with the 5 patches.

David Daney (5):
mn10300: Convert BUG() to use unreachable()
parisc: Convert BUG() to use unreachable()
powerpc: Convert BUG() to use unreachable()
alpha: Convert BUG() to use unreachable()
blackfin: Convert BUG() to use unreachable()

 arch/alpha/include/asm/bug.h    |    3 ++-
 arch/blackfin/include/asm/bug.h |    2 +-
 arch/mn10300/include/asm/bug.h  |    3 ++-
 arch/parisc/include/asm/bug.h   |    4 ++--
 arch/powerpc/include/asm/bug.h  |    2 +-
 5 files changed, 8 insertions(+), 6 deletions(-)
#1 lore raw

PATCH 1/5 mn10300: Convert BUG() to use unreachable()

Use the new unreachable() macro instead of while(1).

---
 arch/mn10300/include/asm/bug.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
arch/mn10300/include/asm/bug.h +2 -1
index aa6a388..447a7e6 100644
@@ -27,7 +27,8 @@ do {								\
 		:						\
 		: "i"(__FILE__), "i"(__LINE__)			\
 		);						\
-} while (1)
+	unreachable();						\
+} while (0)
 
 #define HAVE_ARCH_BUG
 #endif /* CONFIG_BUG */
Signature · 1 line
1.6.2.5
#2 lore raw

PATCH 2/5 parisc: Convert BUG() to use unreachable()

In reply to David Daney

Use the new unreachable() macro instead of for(;;);

---
 arch/parisc/include/asm/bug.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/parisc/include/asm/bug.h +2 -2
index 8cfc553..75e46c5 100644
@@ -32,14 +32,14 @@
 			     "\t.popsection"				\
 			     : : "i" (__FILE__), "i" (__LINE__),	\
 			     "i" (0), "i" (sizeof(struct bug_entry)) ); \
-		for(;;) ;						\
+		unreachable();						\
 	} while(0)
 
 #else
 #define BUG()								\
 	do {								\
 		asm volatile(PARISC_BUG_BREAK_ASM : : );		\
-		for(;;) ;						\
+		unreachable();						\
 	} while(0)
 #endif
 
Signature · 1 line
1.6.2.5
#4 lore raw

PATCH 3/5 powerpc: Convert BUG() to use unreachable()

In reply to David Daney

Use the new unreachable() macro instead of for(;;);

CC Benjamin Herrenschmidt <[email protected]>
CC Paul Mackerras <[email protected]>
---
 arch/powerpc/include/asm/bug.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/powerpc/include/asm/bug.h +1 -1
index 64e1fdc..2c15212 100644
@@ -68,7 +68,7 @@
 		_EMIT_BUG_ENTRY					\
 		: : "i" (__FILE__), "i" (__LINE__),		\
 		    "i" (0), "i"  (sizeof(struct bug_entry)));	\
-	for(;;) ;						\
+	unreachable();						\
 } while (0)
 
 #define BUG_ON(x) do {						\
Signature · 1 line
1.6.2.5
#5 lore raw

PATCH 4/5 alpha: Convert BUG() to use unreachable()

In reply to David Daney

Use the new unreachable() macro instead of for(;;);

CC Richard Henderson <[email protected]>
CC Ivan Kokshaysky <[email protected]>
CC Matt Turner <[email protected]>
---
 arch/alpha/include/asm/bug.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
arch/alpha/include/asm/bug.h +2 -1
index 1720c8a..f091682 100644
@@ -13,7 +13,8 @@
 		"call_pal %0  # bugchk\n\t"				\
 		".long %1\n\t.8byte %2"					\
 		: : "i"(PAL_bugchk), "i"(__LINE__), "i"(__FILE__));	\
-	for ( ; ; ); } while (0)
+	unreachable();							\
+  } while (0)
 
 #define HAVE_ARCH_BUG
 #endif
Signature · 1 line
1.6.2.5
maintainer
#6 lore raw

Re: [PATCH 4/5] alpha: Convert BUG() to use unreachable()

Quoted 26 lines · David Daney

Use the new unreachable() macro instead of for(;;);

CC Richard Henderson <[email protected]>
CC Ivan Kokshaysky <[email protected]>
CC Matt Turner <[email protected]>

---
 arch/alpha/include/asm/bug.h |    3 ++-

 1 files changed, 2 insertions(+), 1 deletions(-)
arch/alpha/include/asm/bug.h +2 -2
index 1720c8a..f091682 100644
@@ -13,7 +13,8 @@
                "call_pal %0  # bugchk\n\t"                             \
                ".long %1\n\t.8byte %2"                                 \
                : : "i"(PAL_bugchk), "i"(__LINE__), "i"(__FILE__));     \
-       for ( ; ; ); } while (0)
+       unreachable();                                                  \
+  } while (0)
 
  #define HAVE_ARCH_BUG
  #endif
--
Quoted 1 line

1.6.2.5

Thanks David. I've pushed this into my tree.

Matt

#7 lore raw

PATCH 5/5 blackfin: Convert BUG() to use unreachable()

In reply to David Daney

Use the new unreachable() macro instead of for(;;);

---
 arch/blackfin/include/asm/bug.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/blackfin/include/asm/bug.h +1 -1
index 6f4548a..75f6dc3 100644
@@ -47,7 +47,7 @@
 #define BUG()								\
 	do {								\
 		_BUG_OR_WARN(0);					\
-		for (;;);						\
+		unreachable();						\
 	} while (0)
 
 #define WARN_ON(condition)							\
Signature · 1 line
1.6.2.5
#8 lore raw

Re: [Uclinux-dist-devel] [PATCH 5/5] blackfin: Convert BUG() to use unreachable()

Quoted 1 line · David Daney

Use the new unreachable() macro instead of for(;;);

sorry, i guess i missed this back in Sept. change looks fine to me (i'll test it later when finishing putting together other patches). you want me to push though my queue ? doesnt matter to me. -mike

#9 lore raw

Re: [Uclinux-dist-devel] [PATCH 5/5] blackfin: Convert BUG() to use unreachable()

Quoted 6 lines · Mike Frysinger
Quoted 1 line · David Daney

Use the new unreachable() macro instead of for(;;);

sorry, i guess i missed this back in Sept. change looks fine to me (i'll test it later when finishing putting together other patches). you want me to push though my queue ? doesnt matter to me.

Yes, if you test it and are happy with it. I have no queue and plan no further action.

David Daney

#10 lore raw

Re: [Uclinux-dist-devel] [PATCH 5/5] blackfin: Convert BUG() to use unreachable()

Quoted 10 lines · David Daney
Quoted 6 lines · Mike Frysinger
Quoted 1 line · David Daney

Use the new unreachable() macro instead of for(;;);

sorry, i guess i missed this back in Sept.  change looks fine to me (i'll test it later when finishing putting together other patches). you want me to push though my queue ?  doesnt matter to me.

Yes, if you test it and are happy with it.  I have no queue and plan no further action.

rgr
-mike