Browse Source

PM / Suspend: Fix bug in suspend statistics update

After commit 2a77c46de1e3dace73745015635ebbc648eca69c
(PM / Suspend: Add statistics debugfs file for suspend to RAM)
a missing pair of braces inside the state_store() function causes even
invalid arguments to suspend to be wrongly treated as failed suspend
attempts. Fix this.

[rjw: Put the hash/subject of the buggy commit into the changelog.]

Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Srivatsa S. Bhat 13 years ago
parent
commit
501a708f18
1 changed files with 2 additions and 1 deletions
  1. 2 1
      kernel/power/main.c

+ 2 - 1
kernel/power/main.c

@@ -290,13 +290,14 @@ static ssize_t state_store(struct kobject *kobj, struct kobj_attribute *attr,
 		if (*s && len == strlen(*s) && !strncmp(buf, *s, len))
 		if (*s && len == strlen(*s) && !strncmp(buf, *s, len))
 			break;
 			break;
 	}
 	}
-	if (state < PM_SUSPEND_MAX && *s)
+	if (state < PM_SUSPEND_MAX && *s) {
 		error = enter_state(state);
 		error = enter_state(state);
 		if (error) {
 		if (error) {
 			suspend_stats.fail++;
 			suspend_stats.fail++;
 			dpm_save_failed_errno(error);
 			dpm_save_failed_errno(error);
 		} else
 		} else
 			suspend_stats.success++;
 			suspend_stats.success++;
+	}
 #endif
 #endif
 
 
  Exit:
  Exit: