fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/28722 )


Change subject: call osmo_timer_del() unconditionally, without 
osmo_timer_pending()
......................................................................

call osmo_timer_del() unconditionally, without osmo_timer_pending()

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

Change-Id: I3e42a74d59b8e8d0d46cc4027676149689cc18a3
---
M src/osmo-bsc/acc.c
M tests/acc/acc_test.c
M tests/gsm0408/gsm0408_test.c
3 files changed, 6 insertions(+), 11 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/22/28722/1

diff --git a/src/osmo-bsc/acc.c b/src/osmo-bsc/acc.c
index 1f23107..80a3576 100644
--- a/src/osmo-bsc/acc.c
+++ b/src/osmo-bsc/acc.c
@@ -73,9 +73,8 @@
                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_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);
 }
diff --git a/tests/acc/acc_test.c b/tests/acc/acc_test.c
index ce3b0cb..887e891 100644
--- a/tests/acc/acc_test.c
+++ b/tests/acc/acc_test.c
@@ -58,10 +58,8 @@
 #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);
diff --git a/tests/gsm0408/gsm0408_test.c b/tests/gsm0408/gsm0408_test.c
index 03b2ee1..999ee80 100644
--- a/tests/gsm0408/gsm0408_test.c
+++ b/tests/gsm0408/gsm0408_test.c
@@ -137,8 +137,7 @@
 #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);

--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/28722
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I3e42a74d59b8e8d0d46cc4027676149689cc18a3
Gerrit-Change-Number: 28722
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanits...@sysmocom.de>
Gerrit-MessageType: newchange

Reply via email to