summaryrefslogtreecommitdiffstats
path: root/kernel/power
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2019-08-10 13:18:06 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2019-08-10 13:18:06 +0200
commit11f26633cccb7243217370837cbb066a73f678a5 (patch)
tree4154ca8230215200b2970375c504dfbe94cc9425 /kernel/power
parentintel-hid: Disable button array during suspend-to-idle (diff)
downloadlinux-11f26633cccb7243217370837cbb066a73f678a5.tar.xz
linux-11f26633cccb7243217370837cbb066a73f678a5.zip
PM: suspend: Fix platform_suspend_prepare_noirq()
After commit ac9eafbe930a ("ACPI: PM: s2idle: Execute LPS0 _DSM functions with suspended devices"), a NULL pointer may be dereferenced if suspend-to-idle is attempted on a platform without "traditional" suspend support due to invalid fall-through in platform_suspend_prepare_noirq(). Fix that and while at it add missing braces in platform_resume_noirq(). Fixes: ac9eafbe930a ("ACPI: PM: s2idle: Execute LPS0 _DSM functions with suspended devices") Reported-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'kernel/power')
-rw-r--r--kernel/power/suspend.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index ed9ddef12b13..f3b7239f1892 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -253,10 +253,10 @@ static int platform_suspend_prepare_late(suspend_state_t state)
static int platform_suspend_prepare_noirq(suspend_state_t state)
{
- if (state == PM_SUSPEND_TO_IDLE) {
- if (s2idle_ops && s2idle_ops->prepare_late)
- return s2idle_ops->prepare_late();
- }
+ if (state == PM_SUSPEND_TO_IDLE)
+ return s2idle_ops && s2idle_ops->prepare_late ?
+ s2idle_ops->prepare_late() : 0;
+
return suspend_ops->prepare_late ? suspend_ops->prepare_late() : 0;
}
@@ -265,8 +265,9 @@ static void platform_resume_noirq(suspend_state_t state)
if (state == PM_SUSPEND_TO_IDLE) {
if (s2idle_ops && s2idle_ops->restore_early)
s2idle_ops->restore_early();
- } else if (suspend_ops->wake)
+ } else if (suspend_ops->wake) {
suspend_ops->wake();
+ }
}
static void platform_resume_early(suspend_state_t state)