]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
frv: kill used but uninitialized variable
authorGeert Uytterhoeven <geert@linux-m68k.org>
Fri, 21 Sep 2012 01:01:54 +0000 (11:01 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 25 Sep 2012 08:46:30 +0000 (18:46 +1000)
Commit 6afe1a1fe8ff83f6a ("PM: Remove legacy PM") removed the
initialization of retval, causing:

arch/frv/kernel/pm.c: In function 'sysctl_pm_do_suspend':
arch/frv/kernel/pm.c:165:5: warning: 'retval' may be used uninitialized in this function [-Wuninitialized]

Remove the variable completely to fix this, and convert to a proper
switch (...) { ... } construct to improve readability.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
arch/frv/kernel/pm.c

index 5fa3889d858bcbb5bc69b97fb6bd85ef3ca0471e..0b579927439d30e1fffc22cc37443df5da474736 100644 (file)
@@ -153,23 +153,22 @@ static int user_atoi(char __user *ubuf, size_t len)
 static int sysctl_pm_do_suspend(ctl_table *ctl, int write,
                                void __user *buffer, size_t *lenp, loff_t *fpos)
 {
-       int retval, mode;
+       int mode;
 
        if (*lenp <= 0)
                return -EIO;
 
        mode = user_atoi(buffer, *lenp);
-       if ((mode != 1) && (mode != 5))
-               return -EINVAL;
+       switch (mode) {
+       case 1:
+           return pm_do_suspend();
 
-       if (retval == 0) {
-               if (mode == 5)
-                   retval = pm_do_bus_sleep();
-               else
-                   retval = pm_do_suspend();
-       }
+       case 5:
+           return pm_do_bus_sleep();
 
-       return retval;
+       default:
+           return -EINVAL;
+       }
 }
 
 static int try_set_cmode(int new_cmode)