diff --git a/sched/wqueue/kwork_notifier.c b/sched/wqueue/kwork_notifier.c index 575599d735d..425f04c6fd2 100644 --- a/sched/wqueue/kwork_notifier.c +++ b/sched/wqueue/kwork_notifier.c @@ -135,9 +135,14 @@ static FAR struct work_notifier_entry_s *work_notifier_find(uint32_t key) static uint32_t work_notifier_key(void) { - static uint32_t g_notifier_key; + static uint32_t notifier_key; - return g_notifier_key++; + if (++notifier_key == 0) + { + ++notifier_key; + } + + return notifier_key; } /**************************************************************************** @@ -283,8 +288,6 @@ int work_notifier_teardown(int key) irqstate_t flags; int ret = OK; - DEBUGASSERT(key > 0 && key <= INT16_MAX); - /* Disable interrupts very briefly. */ flags = enter_critical_section();