This is an automated email from the ASF dual-hosted git repository.
GUIDINGLI pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new da19ad0a74a power: pm: clear the runtime PM context in
pm_runtime_init()
da19ad0a74a is described below
commit da19ad0a74a8f5c60b95bcfc99c111a9b96dd4ae
Author: Honghao Xiang <[email protected]>
AuthorDate: Sun Nov 29 08:38:53 2026 +0000
power: pm: clear the runtime PM context in pm_runtime_init()
pm_runtime_init() set only two of the counters, so any field added later
would start uninitialised, and suspend_work was never cleared at all.
Clear the whole structure before initialising the lock, then set the two
caller-provided fields.
Signed-off-by: Honghao Xiang <[email protected]>
---
drivers/power/pm/pm_runtime.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/power/pm/pm_runtime.c b/drivers/power/pm/pm_runtime.c
index 75b6113d54b..4579d26e285 100644
--- a/drivers/power/pm/pm_runtime.c
+++ b/drivers/power/pm/pm_runtime.c
@@ -187,9 +187,8 @@ void pm_runtime_init(FAR struct pm_runtime_s *rpm,
rpm_state_e state,
{
DEBUGASSERT(rpm != NULL && ops != NULL);
DEBUGASSERT(state == RPM_ACTIVE || state == RPM_SUSPENDED);
+ memset(rpm, 0, sizeof(*rpm));
nxrmutex_init(&rpm->lock);
- rpm->use_count = 0;
- rpm->suspend_delay = 0;
rpm->state = state;
rpm->ops = ops;
}