Skip to content

Commit

Permalink
timer: fix handling of odp_timer_free() return value
Browse files Browse the repository at this point in the history
odp_timer_free() no longer returns an event. Fix handling of the
return value. Also, eliminate one conditional branch dealing with
return values from odp_timer_cancel().

Signed-off-by: Jere Leppänen <[email protected]>
  • Loading branch information
JereLeppanen committed Sep 30, 2024
1 parent 973cc05 commit 69d089d
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/ofp_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -479,23 +479,17 @@ int ofp_timer_cancel(odp_timer_t tim)
return -1;
}
else {
if (odp_timer_cancel(tim, &timeout_event) < 0)
{
OFP_WARN("Timeout already expired or inactive");
return 0;
}

if (timeout_event != ODP_EVENT_INVALID) {
if (odp_timer_cancel(tim, &timeout_event) == ODP_TIMER_SUCCESS) {
tmo = odp_timeout_from_event(timeout_event);
bufdata = odp_timeout_user_ptr(tmo);
odp_buffer_free(bufdata->buf);
odp_timeout_free(tmo);
} else {
OFP_WARN("Lost timeout buffer at timer cancel");
OFP_WARN("odp_timer_cancel failed");
return -1;
}

if (odp_timer_free(tim) != ODP_EVENT_INVALID) {
if (odp_timer_free(tim)) {
OFP_ERR("odp_timer_free failed");
return -1;
}
Expand Down

0 comments on commit 69d089d

Please sign in to comment.