Skip to content

Commit

Permalink
Bluetooth: controller: Fix side effect in assertion
Browse files Browse the repository at this point in the history
Fix side effect in assertion when checking a volatile
variable inside assert check.

Fixes zephyrproject-rtos#32904, zephyrproject-rtos#32923.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
  • Loading branch information
cvinayak committed May 19, 2021
1 parent cd9421a commit 21d616c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion subsys/bluetooth/controller/ll_sw/ull_adv_aux.c
Original file line number Diff line number Diff line change
Expand Up @@ -1060,6 +1060,7 @@ static void mfy_aux_offset_get(void *param)
uint32_t volatile ret_cb;
uint32_t ticks_previous;
uint32_t ret;
bool success;

ticks_previous = ticks_current;

Expand All @@ -1076,7 +1077,8 @@ static void mfy_aux_offset_get(void *param)
}
}

LL_ASSERT(ret_cb == TICKER_STATUS_SUCCESS);
success = (ret_cb == TICKER_STATUS_SUCCESS);
LL_ASSERT(success);

LL_ASSERT((ticks_current == ticks_previous) || retry--);

Expand Down
4 changes: 3 additions & 1 deletion subsys/bluetooth/controller/ll_sw/ull_adv_sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,7 @@ static void mfy_sync_offset_get(void *param)
uint32_t volatile ret_cb;
uint32_t ticks_previous;
uint32_t ret;
bool success;

ticks_previous = ticks_current;

Expand All @@ -923,7 +924,8 @@ static void mfy_sync_offset_get(void *param)
}
}

LL_ASSERT(ret_cb == TICKER_STATUS_SUCCESS);
success = (ret_cb == TICKER_STATUS_SUCCESS);
LL_ASSERT(success);

LL_ASSERT((ticks_current == ticks_previous) || retry--);

Expand Down

0 comments on commit 21d616c

Please sign in to comment.