PM / Sleep: Fix a mistake in a conditional in autosleep_store()
authorArve Hjønnevåg <arve@android.com>
Thu, 3 May 2012 22:14:21 +0000 (00:14 +0200)
committerRafael J. Wysocki <rjw@sisk.pl>
Sat, 5 May 2012 19:50:58 +0000 (21:50 +0200)
The condition check in autosleep_store() is incorrect and prevents
/sys/power/autosleep from working as advertised.  Fix that.

[rjw: Added the changelog.]

Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
kernel/power/main.c

index 54ec071de33795bf01c1599f4ee941f1e5210d56..428f8a034e9684c50a72f41faf71785822456bd5 100644 (file)
@@ -422,7 +422,7 @@ static ssize_t autosleep_store(struct kobject *kobj,
        int error;
 
        if (state == PM_SUSPEND_ON
-           && !(strncmp(buf, "off", 3) && strncmp(buf, "off\n", 4)))
+           && strcmp(buf, "off") && strcmp(buf, "off\n"))
                return -EINVAL;
 
        error = pm_autosleep_set_state(state);