drivers: counter: Fix unbalanced policy state lock

This commit should deal with fixing unbalanced policy state locks.
When PM and PM_DEVICE are declared, default state, policy locks
should be given only when  active.

Signed-off-by: Ioannis Karachalios <ioannis.karachalios.px@renesas.com>
This commit is contained in:
Ioannis Karachalios 2024-11-10 22:37:03 +02:00 committed by Mahesh Mahadevan
parent 88fb090b7f
commit a66c070598

View file

@ -68,7 +68,9 @@ static void counter_smartbond_pm_policy_state_lock_get(const struct device *dev)
static void counter_smartbond_pm_policy_state_lock_put(const struct device *dev)
{
pm_device_runtime_put(dev);
pm_policy_state_lock_put(PM_STATE_STANDBY, PM_ALL_SUBSTATES);
if (pm_policy_state_lock_is_active(PM_STATE_STANDBY, PM_ALL_SUBSTATES)) {
pm_policy_state_lock_put(PM_STATE_STANDBY, PM_ALL_SUBSTATES);
}
}
/*