drivers: regulator: avoid improper access to internal structures
Nothing in the API description the delayed work structure sanctions direct reference to internal fields. Do not assume that a delayed work item can be submitted without delay by invoking k_work_submit() with a reference to the contained work item. Instead submit with the delayed API and no wait. Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This commit is contained in:
parent
fbb7eb81b8
commit
5263289631
1 changed files with 2 additions and 2 deletions
|
@ -190,7 +190,7 @@ static void start(struct onoff_manager *mgr,
|
|||
__ASSERT_NO_MSG(data->task == WORK_TASK_UNDEFINED);
|
||||
data->task = WORK_TASK_ENABLE;
|
||||
data->notify = notify;
|
||||
k_work_submit(&data->delayed_work.work);
|
||||
k_delayed_work_submit(&data->delayed_work, K_NO_WAIT);
|
||||
return;
|
||||
}
|
||||
#endif /* CONFIG_MULTITHREADING */
|
||||
|
@ -228,7 +228,7 @@ static void stop(struct onoff_manager *mgr,
|
|||
__ASSERT_NO_MSG(data->task == WORK_TASK_UNDEFINED);
|
||||
data->task = WORK_TASK_DISABLE;
|
||||
data->notify = notify;
|
||||
k_work_submit(&data->delayed_work.work);
|
||||
k_delayed_work_submit(&data->delayed_work, K_NO_WAIT);
|
||||
return;
|
||||
}
|
||||
#endif /* CONFIG_MULTITHREADING */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue