From da5aaeda2bc29ef71fbef83323cfca737320322e Mon Sep 17 00:00:00 2001 From: Matthew Kennedy Date: Fri, 27 Aug 2021 01:46:01 -0700 Subject: [PATCH] detect "not scheduled" faster (#3200) * fatal if not found * handle not-scheduled Co-authored-by: Matthew Kennedy --- firmware/controllers/system/timer/event_queue.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/firmware/controllers/system/timer/event_queue.cpp b/firmware/controllers/system/timer/event_queue.cpp index e3987546bc..ddb4cc7679 100644 --- a/firmware/controllers/system/timer/event_queue.cpp +++ b/firmware/controllers/system/timer/event_queue.cpp @@ -77,6 +77,11 @@ void EventQueue::remove(scheduling_s* scheduling) { assertListIsSorted(); #endif /* EFI_UNIT_TEST */ + // Special case: event isn't scheduled, so don't cancel it + if (!scheduling->action) { + return; + } + // Special case: empty list, nothing to do if (!head) { return; @@ -97,8 +102,9 @@ void EventQueue::remove(scheduling_s* scheduling) { current = current->nextScheduling_s; } - // Walked off the end, not present, nothing more to do + // Walked off the end, this is an error since this *should* have been scheduled if (!current) { + firmwareError(OBD_PCM_Processor_Fault, "EventQueue::remove didn't find element"); return; }