From 28ef0ee121aa93399d8684a59d6ca66ee07ade84 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Mon, 12 Oct 2020 08:35:18 -0400 Subject: *: Use proper semantics for turning off thread We have this pattern in the code base: if (thread) THREAD_OFF(thread); If we look at THREAD_OFF we check to see if thread is non-null too. So we have a double check. This is unnecessary. Convert to just using THREAD_OFF Signed-off-by: Donald Sharp --- lib/ldp_sync.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'lib/ldp_sync.c') diff --git a/lib/ldp_sync.c b/lib/ldp_sync.c index 5dd045d88d..9657f0b1df 100644 --- a/lib/ldp_sync.c +++ b/lib/ldp_sync.c @@ -79,10 +79,8 @@ bool ldp_sync_if_down(struct ldp_sync_info *ldp_sync_info) * update state */ if (ldp_sync_info && ldp_sync_info->enabled == LDP_IGP_SYNC_ENABLED) { - if (ldp_sync_info->t_holddown != NULL) { - THREAD_TIMER_OFF(ldp_sync_info->t_holddown); - ldp_sync_info->t_holddown = NULL; - } + THREAD_TIMER_OFF(ldp_sync_info->t_holddown); + if (ldp_sync_info->state == LDP_IGP_SYNC_STATE_REQUIRED_UP) ldp_sync_info->state = LDP_IGP_SYNC_STATE_REQUIRED_NOT_UP; -- cgit v1.2.3