Skip to content

Commit 682c835

Browse files
pm: device_runtime: put_sync_locked: fix usage count on err
If pm action fails within put_sync_locked, usage count should be reset to reflect the state of the device. Signed-off-by: Bjarki Arge Andreasen <[email protected]>
1 parent b2ea652 commit 682c835

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

subsys/pm/device_runtime.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ static int put_sync_locked(const struct device *dev)
321321
if (pm->base.usage == 0U) {
322322
ret = pm->base.action_cb(dev, PM_DEVICE_ACTION_SUSPEND);
323323
if (ret < 0) {
324+
pm->base.usage++;
324325
return ret;
325326
}
326327
pm->base.state = PM_DEVICE_STATE_SUSPENDED;

0 commit comments

Comments
 (0)