summaryrefslogtreecommitdiffstats
path: root/arch/frv/kernel/pm.c
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert@linux-m68k.org>2012-10-05 02:12:16 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-05 20:04:46 +0200
commit87be8932ae55da702411328c1438e29905ced40a (patch)
treedb6989ffd6d68cf25ae3e1e87b941776055cd057 /arch/frv/kernel/pm.c
parentsections: fix const sections for crc32 table (diff)
downloadlinux-87be8932ae55da702411328c1438e29905ced40a.tar.xz
linux-87be8932ae55da702411328c1438e29905ced40a.zip
frv: kill used but uninitialized variable
Commit 6afe1a1fe8ff ("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> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/frv/kernel/pm.c')
-rw-r--r--arch/frv/kernel/pm.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/arch/frv/kernel/pm.c b/arch/frv/kernel/pm.c
index 5fa3889d858b..0b579927439d 100644
--- a/arch/frv/kernel/pm.c
+++ b/arch/frv/kernel/pm.c
@@ -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)