]> err.no Git - linux-2.6/commitdiff
[PATCH] sleep: Fix oops in enter_state
authorPavel Machek <pavel@ucw.cz>
Wed, 9 Nov 2005 05:34:30 +0000 (21:34 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Wed, 9 Nov 2005 15:55:50 +0000 (07:55 -0800)
If ACPI sleep is not configured, but someone still wants to run swsusp,
he'd get oops in enter_state.  This is regression since 2.6.14 and this
fixes it.

Signed-off-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
kernel/power/main.c

index 18d7d693fbba852c48acc40de4ad8809baf5d36e..6ee2cad530e8971f4ad69da2f94d96455039fc5e 100644 (file)
@@ -167,7 +167,7 @@ static int enter_state(suspend_state_t state)
 {
        int error;
 
-       if (pm_ops->valid && !pm_ops->valid(state))
+       if (pm_ops && pm_ops->valid && !pm_ops->valid(state))
                return -ENODEV;
        if (down_trylock(&pm_sem))
                return -EBUSY;