Skip to content

Commit

Permalink
pal: remove unncessary timer object casting
Browse files Browse the repository at this point in the history
Possible fix for sporadic test failures.
Casting away a const can cause undefined behavior.
We are not modifying timer object anyway,
so we can use const pointer further.

Signed-off-by: Krzysztof Taborowski <[email protected]>
  • Loading branch information
ktaborowski committed Apr 8, 2024
1 parent fed2f4d commit 273ff86
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions subsys/sal/sid_pal/src/sid_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ static const struct sid_timespec *sid_pal_timer_get_tolerance(sid_pal_timer_prio
return tolerance;
}

static bool sid_pal_timer_list_in_list(sid_pal_timer_t *timer)
static bool sid_pal_timer_list_in_list(const sid_pal_timer_t *timer)
{
SID_PAL_ASSERT(timer);
bool result = true;
Expand Down Expand Up @@ -214,9 +214,8 @@ bool sid_pal_timer_is_armed(const sid_pal_timer_t *timer_storage)
if (!timer_storage) {
return false;
}
sid_pal_timer_t *timer = (sid_pal_timer_t *)timer_storage;

return sid_pal_timer_list_in_list(timer);
return sid_pal_timer_list_in_list(timer_storage);
}

void sid_pal_timer_event_callback(void *arg, const struct sid_timespec *now)
Expand Down

0 comments on commit 273ff86

Please sign in to comment.