Skip to contentSkip to conversation

sparc: us2e_cpufreq.c: fix warnings/errors

PATCH In review Alexander Beregalov 2 participants 2 messages Dec 20, 2009 – Dec 21, 2009 SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 sparc: us2e_cpufreq.c: fix warnings/errors

Fix warnings which become build errors since -Werror is used. arch/sparc/kernel/us2e_cpufreq.c:180: error: control reaches end of non-void function arch/sparc/kernel/us2e_cpufreq.c:203: error: control reaches end of non-void function

---
 arch/sparc/kernel/us2e_cpufreq.c |   28 ++++++++++++++++++----------
 1 files changed, 18 insertions(+), 10 deletions(-)
arch/sparc/kernel/us2e_cpufreq.c +18 -10
index 791c151..d505233 100644
@@ -158,48 +158,56 @@ static void us2e_transition(unsigned long estar, unsigned long new_bits,
 
 static unsigned long index_to_estar_mode(unsigned int index)
 {
+	unsigned long ret = 0;
+
 	switch (index) {
 	case 0:
-		return ESTAR_MODE_DIV_1;
+		ret = ESTAR_MODE_DIV_1;
 
 	case 1:
-		return ESTAR_MODE_DIV_2;
+		ret = ESTAR_MODE_DIV_2;
 
 	case 2:
-		return ESTAR_MODE_DIV_4;
+		ret = ESTAR_MODE_DIV_4;
 
 	case 3:
-		return ESTAR_MODE_DIV_6;
+		ret = ESTAR_MODE_DIV_6;
 
 	case 4:
-		return ESTAR_MODE_DIV_8;
+		ret = ESTAR_MODE_DIV_8;
 
 	default:
 		BUG();
 	};
+
+	return ret;
 }
 
 static unsigned long index_to_divisor(unsigned int index)
 {
+	unsigned long ret = 0;
+
 	switch (index) {
 	case 0:
-		return 1;
+		ret = 1;
 
 	case 1:
-		return 2;
+		ret = 2;
 
 	case 2:
-		return 4;
+		ret = 4;
 
 	case 3:
-		return 6;
+		ret = 6;
 
 	case 4:
-		return 8;
+		ret = 8;
 
 	default:
 		BUG();
 	};
+
+	return ret;
 }
 
 static unsigned long estar_to_divisor(unsigned long estar)
Signature · 1 line
1.6.6.rc3
maintainer
#1 lore raw

From: Alexander Beregalov <[email protected]>
Date: Sun, 20 Dec 2009 15:16:36 +0300

Quoted 5 lines

Fix warnings which become build errors since -Werror is used. arch/sparc/kernel/us2e_cpufreq.c:180: error: control reaches end of non-void function arch/sparc/kernel/us2e_cpufreq.c:203: error: control reaches end of non-void function

Same problem as patch #1, the BUG() in the default switch case makes the end of the function unreachable, GCC should not warn about this. And it never has before.

Something changed to make this start happening.