Skip to content

pm: Fix to prevent incorrect forever timeout #93114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion subsys/pm/pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,12 @@ bool pm_system_suspend(int32_t kernel_ticks)
/*
* We need to set the timer to interrupt a little bit early to
* accommodate the time required by the CPU to fully wake up.
*
* Since K_TICKS_FOREVER is defined as -1, ensure that -1
* is not passed as the next timeout.
*
*/
sys_clock_set_timeout(ticks - exit_latency_ticks, true);
sys_clock_set_timeout(MAX(0, ticks - exit_latency_ticks), true);
}

/*
Expand Down