Repository navigation
platform/surface: platform_profile: fix uninitialized return in pm_prepare - #197
Merged
qzed merged 1 commit intoNov 16, 2026
Conversation
…epare
surface_platform_profile_pm_prepare() declares "int status;" without an
initializer and only assigns it inside the "if (tpd->has_fan)" block.
On devices where the "has_fan" property is not set, such as the Surface
Pro 7 and the Surface Book 3, the function returns whatever happens to be
on the stack. Any non-zero value makes the PM core abort the transition:
surface_platform_profile 01:03:01:00:01: PM: device_prepare():
surface_platform_profile_pm_prepare [surface_platform_profile]
returns -1050009088
surface_platform_profile 01:03:01:00:01: PM: not prepared for power
transition: code -1050009088
PM: Some devices failed to suspend, or early wake event detected
and the machine immediately resumes instead of suspending.
Initialize status to 0 so that devices without a fan report success.
Fixes: 743c726 ("platform/surface: platform_profile: add fan power state handling")
Signed-off-by: Lars Schellhas van Kisfeld <lars.schellhas-van-kisfeld@schellhasconsulting.de>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
surface_platform_profile_pm_prepare()(added in #166) only assignsstatusinsideif (tpd->has_fan). On devices without thehas_fanproperty it returns an uninitialized value, so the PM core aborts every suspend withnot prepared for power transition: code <random negative number>:Fix: initialize
status = 0.Fixes linux-surface/linux-surface#2386
Tested on a Surface Book 3, 7.3.4-1-surface, with the patched module loaded via insmod: 3 of 3
systemctl suspendattempts (s2idle, RTC wake after 25 s) entered and left suspend with nonot prepared for power transitionmessage. Without the patch, 93 of 94 attempts since 2026-11-15 failed with it.Note (not part of the fix): as written, a failing fan-standby call also aborts suspend. If that is not intended, returning 0 after the
dev_err()would be more forgiving.