Skip to content

Commit d7e6d6e

Browse files
rugeGerritsenaescolar
authored andcommitted
Bluetooth: Controller: Fix deinitialization of the LFCLK
This fixes a bug where the stack may get stuck in the POWER_CLOCK ISR after enabling and disabling the Bluetooth stack a couple of times. It happens after calling `onoff_request()` after a failing call to `onoff_release()`. Then the `lf_cli`s next points to itself, generating a circular list of clients. Calling `onoff_release()` may fail if there is an outstanding request. By calling `onoff_cancel()` we enter a state where we can safely remove the client. This was not seen earlier because the return value from `ll_deinit()` in `hci_driver_close()` was ignored. Signed-off-by: Rubin Gerritsen <[email protected]>
1 parent 1cc8200 commit d7e6d6e

File tree

1 file changed

+3
-0
lines changed
  • subsys/bluetooth/controller/ll_sw/nordic/lll

1 file changed

+3
-0
lines changed

subsys/bluetooth/controller/ll_sw/nordic/lll/lll_clock.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ int lll_clock_deinit(void)
6666
struct onoff_manager *mgr =
6767
z_nrf_clock_control_get_onoff(CLOCK_CONTROL_NRF_SUBSYS_LF);
6868

69+
/* Cancel any ongoing request */
70+
(void)onoff_cancel(mgr, &lf_cli);
71+
6972
return onoff_release(mgr);
7073
}
7174

0 commit comments

Comments
 (0)