diff --git a/lib/posix/options/timer.c b/lib/posix/options/timer.c index 3c14a01a3add3..e810b4576f7c9 100644 --- a/lib/posix/options/timer.c +++ b/lib/posix/options/timer.c @@ -190,7 +190,7 @@ int timer_create(clockid_t clockid, struct sigevent *evp, timer_t *timerid) goto out; free_timer: - k_mem_slab_free(&posix_timer_slab, (void *)&timer); + k_mem_slab_free(&posix_timer_slab, (void *)timer); out: return ret; diff --git a/tests/posix/timers/prj.conf b/tests/posix/timers/prj.conf index e6119b6df54f9..8567a0bbf46a1 100644 --- a/tests/posix/timers/prj.conf +++ b/tests/posix/timers/prj.conf @@ -3,3 +3,8 @@ CONFIG_ZTEST=y CONFIG_POSIX_AEP_CHOICE_BASE=y CONFIG_POSIX_TIMERS=y + +# Needed for timer_create() when using SIGEV_THREAD +CONFIG_DYNAMIC_THREAD=y +CONFIG_DYNAMIC_THREAD_POOL_SIZE=1 +CONFIG_THREAD_STACK_INFO=y diff --git a/tests/posix/timers/src/timer.c b/tests/posix/timers/src/timer.c index faad7f659fcb2..1d4936d6a4be6 100644 --- a/tests/posix/timers/src/timer.c +++ b/tests/posix/timers/src/timer.c @@ -154,14 +154,4 @@ static void after(void *arg) } } -static void before(void *arg) -{ - ARG_UNUSED(arg); - - if (!IS_ENABLED(CONFIG_DYNAMIC_THREAD)) { - /* skip redundant testing if there is no thread pool / heap allocation */ - ztest_test_skip(); - } -} - -ZTEST_SUITE(posix_timers, NULL, NULL, before, after, NULL); +ZTEST_SUITE(posix_timers, NULL, NULL, NULL, after, NULL);