kernel: work: Add missing ASSERT for args

Add missing ASSERT for dwork & queue.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
This commit is contained in:
Lingao Meng 2024-09-24 12:07:21 +08:00 committed by Fabio Baltieri
commit 836fa88cbd
2 changed files with 5 additions and 1 deletions

View file

@ -867,6 +867,8 @@ static inline int work_delayable_busy_get_locked(const struct k_work_delayable *
int k_work_delayable_busy_get(const struct k_work_delayable *dwork)
{
__ASSERT_NO_MSG(dwork != NULL);
k_spinlock_key_t key = k_spin_lock(&lock);
int ret = work_delayable_busy_get_locked(dwork);
@ -968,6 +970,7 @@ int k_work_schedule_for_queue(struct k_work_q *queue,
struct k_work_delayable *dwork,
k_timeout_t delay)
{
__ASSERT_NO_MSG(queue != NULL);
__ASSERT_NO_MSG(dwork != NULL);
SYS_PORT_TRACING_OBJ_FUNC_ENTER(k_work, schedule_for_queue, queue, dwork, delay);
@ -1004,6 +1007,7 @@ int k_work_reschedule_for_queue(struct k_work_q *queue,
struct k_work_delayable *dwork,
k_timeout_t delay)
{
__ASSERT_NO_MSG(queue != NULL);
__ASSERT_NO_MSG(dwork != NULL);
SYS_PORT_TRACING_OBJ_FUNC_ENTER(k_work, reschedule_for_queue, queue, dwork, delay);

View file

@ -1038,7 +1038,7 @@ static void handle_1cpu_basic_schedule_running(struct k_work *work)
*/
if (atomic_dec(&resubmits_left) > 0) {
/* Schedule again on current queue */
state->schedule_res = k_work_schedule_for_queue(NULL, one_dwork,
state->schedule_res = k_work_schedule_for_queue(one_dwork->work.queue, one_dwork,
K_MSEC(DELAY_MS));
} else {
/* Flag that it didn't schedule */