power: Add an assert for an unexpected condition

Exit latency time should never be greater than the residency time.
Just add an assert in case the policy does not properly handle it.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
Flavio Ceolin
2021-04-19 19:36:10 -07:00
committed by Anas Nashif
parent fba5779a8d
commit 11ac18abc2

View File

@@ -182,6 +182,14 @@ enum pm_state pm_system_suspend(int32_t ticks)
post_ops_done = 0;
if (ticks != K_TICKS_FOREVER) {
/*
* Just a sanity check in case the policy manager does not
* handle this error condition properly.
*/
__ASSERT(z_power_state.min_residency_us >=
z_power_state.exit_latency_us,
"min_residency_us < exit_latency_us");
/*
* We need to set the timer to interrupt a little bit early to
* accommodate the time required by the CPU to fully wake up.