diff options
author | Geert Uytterhoeven <geert@linux-m68k.org> | 2012-10-04 20:12:16 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-05 14:04:46 -0400 |
commit | 87be8932ae55da702411328c1438e29905ced40a (patch) | |
tree | db6989ffd6d68cf25ae3e1e87b941776055cd057 /arch/frv | |
parent | 8f243af42adef5f589b8e39656284ca9c9374e44 (diff) |
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')
-rw-r--r-- | arch/frv/kernel/pm.c | 19 |
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) | |||
153 | static int sysctl_pm_do_suspend(ctl_table *ctl, int write, | 153 | static int sysctl_pm_do_suspend(ctl_table *ctl, int write, |
154 | void __user *buffer, size_t *lenp, loff_t *fpos) | 154 | void __user *buffer, size_t *lenp, loff_t *fpos) |
155 | { | 155 | { |
156 | int retval, mode; | 156 | int mode; |
157 | 157 | ||
158 | if (*lenp <= 0) | 158 | if (*lenp <= 0) |
159 | return -EIO; | 159 | return -EIO; |
160 | 160 | ||
161 | mode = user_atoi(buffer, *lenp); | 161 | mode = user_atoi(buffer, *lenp); |
162 | if ((mode != 1) && (mode != 5)) | 162 | switch (mode) { |
163 | return -EINVAL; | 163 | case 1: |
164 | return pm_do_suspend(); | ||
164 | 165 | ||
165 | if (retval == 0) { | 166 | case 5: |
166 | if (mode == 5) | 167 | return pm_do_bus_sleep(); |
167 | retval = pm_do_bus_sleep(); | ||
168 | else | ||
169 | retval = pm_do_suspend(); | ||
170 | } | ||
171 | 168 | ||
172 | return retval; | 169 | default: |
170 | return -EINVAL; | ||
171 | } | ||
173 | } | 172 | } |
174 | 173 | ||
175 | static int try_set_cmode(int new_cmode) | 174 | static int try_set_cmode(int new_cmode) |