summaryrefslogtreecommitdiff
path: root/nuttx/sched/wd_cancel.c
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/sched/wd_cancel.c')
-rw-r--r--nuttx/sched/wd_cancel.c48
1 files changed, 22 insertions, 26 deletions
diff --git a/nuttx/sched/wd_cancel.c b/nuttx/sched/wd_cancel.c
index 0bd59cf89..a1c220873 100644
--- a/nuttx/sched/wd_cancel.c
+++ b/nuttx/sched/wd_cancel.c
@@ -123,38 +123,34 @@ int wd_cancel (WDOG_ID wdid)
* error has occurred because the watchdog is marked active!
*/
- if (!curr)
+ ASSERT(curr);
+
+ /* If there is a watchdog in the timer queue after the one that
+ * is being canceled, then it inherits the remaining ticks.
+ */
+
+ if (curr->next)
+ {
+ curr->next->lag += curr->lag;
+ }
+
+ /* Now, remove the watchdog from the timer queue */
+
+ if (prev)
{
- PANIC(OSERR_WDOGNOTFOUND);
+ (void)sq_remafter((FAR sq_entry_t*)prev, &g_wdactivelist);
}
else
{
- /* If there is a watchdog in the timer queue after the one that
- * is being canceled, then it inherits the remaining ticks.
- */
-
- if (curr->next)
- {
- curr->next->lag += curr->lag;
- }
-
- /* Now, remove the watchdog from the timer queue */
-
- if (prev)
- {
- (void)sq_remafter((FAR sq_entry_t*)prev, &g_wdactivelist);
- }
- else
- {
- (void)sq_remfirst(&g_wdactivelist);
- }
- wdid->next = NULL;
-
- /* Return success */
-
- ret = OK;
+ (void)sq_remfirst(&g_wdactivelist);
}
+ wdid->next = NULL;
+
+ /* Return success */
+
+ ret = OK;
+
/* Mark the watchdog inactive */
wdid->active = false;