Skip to content

Commit

Permalink
frv: kill used but uninitialized variable
Browse files Browse the repository at this point in the history
Commit 6afe1a1 ("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 <[email protected]>
Cc: David Howells <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
geertu authored and torvalds committed Oct 5, 2012
1 parent 8f243af commit 87be893
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions arch/frv/kernel/pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 87be893

Please sign in to comment.