Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions kernel/work.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <zephyr/spinlock.h>
#include <errno.h>
#include <ksched.h>
#include <zephyr/sys/__assert.h>
#include <zephyr/sys/printk.h>
#include <zephyr/logging/log.h>

Expand Down Expand Up @@ -155,6 +156,7 @@ void k_work_init(struct k_work *work,
{
__ASSERT_NO_MSG(work != NULL);
__ASSERT_NO_MSG(handler != NULL);
__ASSERT_NO_MSG(!k_work_is_pending(work));

*work = (struct k_work)Z_WORK_INITIALIZER(handler);

Expand Down Expand Up @@ -986,6 +988,7 @@ void k_work_init_delayable(struct k_work_delayable *dwork,
{
__ASSERT_NO_MSG(dwork != NULL);
__ASSERT_NO_MSG(handler != NULL);
__ASSERT_NO_MSG(!k_work_delayable_is_pending(dwork));

*dwork = (struct k_work_delayable){
.work = {
Expand Down
8 changes: 4 additions & 4 deletions tests/kernel/workq/work_queue/src/start_stop.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ static void work_handler(struct k_work *work)
ZTEST(workqueue_api, test_k_work_queue_start_stop)
{
size_t i;
struct k_work work;
struct k_work work = {0};
struct k_work_q work_q = {0};
struct k_work works[NUM_TEST_ITEMS];
struct k_work works[NUM_TEST_ITEMS] = {0};
struct k_work_queue_config cfg = {
.name = "test_work_q",
.no_yield = true,
Expand Down Expand Up @@ -82,9 +82,9 @@ ZTEST(workqueue_api, test_k_work_queue_run_stop)
int rc;
size_t i;
struct k_thread thread;
struct k_work work;
struct k_work work = {0};
struct k_work_q work_q = {0};
struct k_work works[NUM_TEST_ITEMS];
struct k_work works[NUM_TEST_ITEMS] = {0};
struct k_sem ret_sem;

k_sem_init(&ret_sem, 0, 1);
Expand Down
Loading