From 126ce6428eabe6c6ac85fe6bfc8b27dabcc21bc4 Mon Sep 17 00:00:00 2001 From: luoyong1 Date: Fri, 19 Aug 2022 14:02:45 +0800 Subject: [PATCH] sched/semaphore: add the wdog judge before cancel N/A to avoid entering critical again in wd_cancel when wdog not actived. But when the wdog is actived, may add more judge --- sched/semaphore/sem_post.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sched/semaphore/sem_post.c b/sched/semaphore/sem_post.c index d5fd3842df..851c5f2f7f 100644 --- a/sched/semaphore/sem_post.c +++ b/sched/semaphore/sem_post.c @@ -151,7 +151,10 @@ int nxsem_post(FAR sem_t *sem) /* Stop the watchdog timer */ - wd_cancel(&stcb->waitdog); + if (WDOG_ISACTIVE(&stcb->waitdog)) + { + wd_cancel(&stcb->waitdog); + } /* Restart the waiting task. */