Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[PATCH] PM / Suspend: Fix bug in suspend statistics update

7 views
Skip to first unread message

Srivatsa S. Bhat

unread,
Nov 19, 2011, 4:30:02 AM11/19/11
to
A pair of missing braces inside the state_store() function causes even
invalid arguments to suspend to be wrongly treated as failed suspend
attempts. Fix this.

Signed-off-by: Srivatsa S. Bhat <srivat...@linux.vnet.ibm.com>
---

kernel/power/main.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/kernel/power/main.c b/kernel/power/main.c
index 71f49fe..36e0f09 100644
--- a/kernel/power/main.c
+++ b/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))
break;
}
- if (state < PM_SUSPEND_MAX && *s)
+ if (state < PM_SUSPEND_MAX && *s) {
error = enter_state(state);
if (error) {
suspend_stats.fail++;
dpm_save_failed_errno(error);
} else
suspend_stats.success++;
+ }
#endif

Exit:

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majo...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Rafael J. Wysocki

unread,
Nov 19, 2011, 8:50:01 AM11/19/11
to
On Saturday, November 19, 2011, Srivatsa S. Bhat wrote:
> A pair of missing braces inside the state_store() function causes even
> invalid arguments to suspend to be wrongly treated as failed suspend
> attempts. Fix this.
>
> Signed-off-by: Srivatsa S. Bhat <srivat...@linux.vnet.ibm.com>

Good catch! Applied to linux-pm/pm-fixes.

Thanks,
Rafael


> ---
>
> kernel/power/main.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/kernel/power/main.c b/kernel/power/main.c
> index 71f49fe..36e0f09 100644
> --- a/kernel/power/main.c
> +++ b/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))
> break;
> }
> - if (state < PM_SUSPEND_MAX && *s)
> + if (state < PM_SUSPEND_MAX && *s) {
> error = enter_state(state);
> if (error) {
> suspend_stats.fail++;
> dpm_save_failed_errno(error);
> } else
> suspend_stats.success++;
> + }
> #endif
>
> Exit:
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pm" in

Pavel Machek

unread,
Nov 22, 2011, 6:50:02 AM11/22/11
to
On Sat 2011-11-19 14:50:26, Srivatsa S. Bhat wrote:
> A pair of missing braces inside the state_store() function causes even
> invalid arguments to suspend to be wrongly treated as failed suspend
> attempts. Fix this.
>
> Signed-off-by: Srivatsa S. Bhat <srivat...@linux.vnet.ibm.com>

ACK.
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
0 new messages