Skip to content

Commit a66c070

Browse files
ioannis-karachaliosmmahadevan108
authored andcommitted
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 <[email protected]>
1 parent 88fb090 commit a66c070

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/counter/counter_smartbond_timer.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ static void counter_smartbond_pm_policy_state_lock_get(const struct device *dev)
6868
static void counter_smartbond_pm_policy_state_lock_put(const struct device *dev)
6969
{
7070
pm_device_runtime_put(dev);
71-
pm_policy_state_lock_put(PM_STATE_STANDBY, PM_ALL_SUBSTATES);
71+
if (pm_policy_state_lock_is_active(PM_STATE_STANDBY, PM_ALL_SUBSTATES)) {
72+
pm_policy_state_lock_put(PM_STATE_STANDBY, PM_ALL_SUBSTATES);
73+
}
7274
}
7375

7476
/*

0 commit comments

Comments
 (0)