call osmo_timer_del() unconditionally, without osmo_timer_pending()

osmo_timer_del() does check if a timer is active internally.

Change-Id: I3e42a74d59b8e8d0d46cc4027676149689cc18a3
This commit is contained in:
Vadim Yanitskiy 2022-07-22 03:39:11 +07:00
parent b41ccb795e
commit ac8acc98a3
3 changed files with 6 additions and 11 deletions

View File

@ -73,9 +73,8 @@ static void acc_mgr_enable_rotation_cond(struct acc_mgr *acc_mgr)
if (!osmo_timer_pending(&acc_mgr->rotate_timer))
osmo_timer_schedule(&acc_mgr->rotate_timer, acc_mgr->rotation_time_sec, 0);
} else {
/* No rotation needed, disable rotation timer */
if (osmo_timer_pending(&acc_mgr->rotate_timer))
osmo_timer_del(&acc_mgr->rotate_timer);
/* No rotation needed, disable rotation timer (if pending) */
osmo_timer_del(&acc_mgr->rotate_timer);
}
}
@ -565,8 +564,7 @@ void acc_ramp_trigger(struct acc_ramp *acc_ramp)
*/
void acc_ramp_abort(struct acc_ramp *acc_ramp)
{
if (osmo_timer_pending(&acc_ramp->step_timer))
osmo_timer_del(&acc_ramp->step_timer);
osmo_timer_del(&acc_ramp->step_timer);
acc_mgr_set_len_allowed_ramp(&acc_ramp->bts->acc_mgr, 10);
}

View File

@ -58,10 +58,8 @@ static inline struct gsm_bts *_bts_init(struct gsm_network *net, const char *msg
#define bts_del(bts) _bts_del(bts, __func__)
static inline void _bts_del(struct gsm_bts *bts, const char *msg)
{
if (osmo_timer_pending(&bts->acc_mgr.rotate_timer))
osmo_timer_del(&bts->acc_mgr.rotate_timer);
if (osmo_timer_pending(&bts->acc_ramp.step_timer))
osmo_timer_del(&bts->acc_ramp.step_timer);
osmo_timer_del(&bts->acc_mgr.rotate_timer);
osmo_timer_del(&bts->acc_ramp.step_timer);
/* no need to llist_del(&bts->list), we never registered the bts there. */
talloc_free(bts->site_mgr);
fprintf(stderr, "BTS deallocated OK in %s()\n", msg);

View File

@ -137,8 +137,7 @@ static inline struct gsm_bts *_bts_init(struct gsm_network *net, const char *msg
#define bts_del(bts) _bts_del(bts, __func__)
static inline void _bts_del(struct gsm_bts *bts, const char *msg)
{
if (osmo_timer_pending(&bts->acc_mgr.rotate_timer))
osmo_timer_del(&bts->acc_mgr.rotate_timer);
osmo_timer_del(&bts->acc_mgr.rotate_timer);
/* no need to llist_del(&bts->list), we never registered the bts there. */
talloc_free(bts->site_mgr);
printf("BTS deallocated OK in %s()\n", msg);