sched/notifier: fix invaild unique key

N/A

Change-Id: Ie63af2a24a0421239d40b580b841cbf5abae446f
Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
chao.an
2021-01-29 18:08:52 +08:00
committed by chao an
parent 5e77dea5af
commit effa0e0b1a
+7 -4
View File
@@ -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();