diff mbox

[2/2] sparc: us2e_cpufreq.c: fix warnings/errors

Message ID 1261311396-609-2-git-send-email-a.beregalov@gmail.com
State Changes Requested
Delegated to: David Miller
Headers show

Commit Message

Alexander Beregalov Dec. 20, 2009, 12:16 p.m. UTC
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

Signed-off-by: Alexander Beregalov <a.beregalov@gmail.com>
---
 arch/sparc/kernel/us2e_cpufreq.c |   28 ++++++++++++++++++----------
 1 files changed, 18 insertions(+), 10 deletions(-)

Comments

David Miller Dec. 21, 2009, 2:37 a.m. UTC | #1
From: Alexander Beregalov <a.beregalov@gmail.com>
Date: Sun, 20 Dec 2009 15:16:36 +0300

> 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
> 
> Signed-off-by: Alexander Beregalov <a.beregalov@gmail.com>

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.
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/sparc/kernel/us2e_cpufreq.c b/arch/sparc/kernel/us2e_cpufreq.c
index 791c151..d505233 100644
--- a/arch/sparc/kernel/us2e_cpufreq.c
+++ b/arch/sparc/kernel/us2e_cpufreq.c
@@ -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)