Bluetooth: controller: Avoid assignments in if statement
Rework the ctrl_lrpa_get() function so that it doesn't require an assignment to be present inside the if statement, yielding smaller and safer code. Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
This commit is contained in:
parent
f23aaeb7f4
commit
f6405dfd93
2 changed files with 6 additions and 6 deletions
|
@ -1258,8 +1258,8 @@ static inline u32_t isr_rx_scan(u8_t devmatch_ok, u8_t devmatch_id,
|
|||
pdu_adv_tx->rx_addr = pdu_adv_rx->tx_addr;
|
||||
pdu_adv_tx->len = sizeof(struct pdu_adv_payload_connect_ind);
|
||||
#if defined(CONFIG_BLUETOOTH_CONTROLLER_PRIVACY)
|
||||
if (_radio.scanner.rpa_gen && rl_idx != FILTER_IDX_NONE &&
|
||||
(lrpa = ctrl_lrpa_get(rl_idx))) {
|
||||
lrpa = ctrl_lrpa_get(rl_idx);
|
||||
if (_radio.scanner.rpa_gen && lrpa) {
|
||||
pdu_adv_tx->tx_addr = 1;
|
||||
memcpy(&pdu_adv_tx->payload.connect_ind.init_addr[0],
|
||||
lrpa->val, BDADDR_SIZE);
|
||||
|
@ -1501,8 +1501,8 @@ static inline u32_t isr_rx_scan(u8_t devmatch_ok, u8_t devmatch_id,
|
|||
pdu_adv_tx->rx_addr = pdu_adv_rx->tx_addr;
|
||||
pdu_adv_tx->len = sizeof(struct pdu_adv_payload_scan_req);
|
||||
#if defined(CONFIG_BLUETOOTH_CONTROLLER_PRIVACY)
|
||||
if (_radio.scanner.rpa_gen && rl_idx != FILTER_IDX_NONE &&
|
||||
(lrpa = ctrl_lrpa_get(rl_idx))) {
|
||||
lrpa = ctrl_lrpa_get(rl_idx);
|
||||
if (_radio.scanner.rpa_gen && lrpa) {
|
||||
pdu_adv_tx->tx_addr = 1;
|
||||
memcpy(&pdu_adv_tx->payload.scan_req.scan_addr[0],
|
||||
lrpa->val, BDADDR_SIZE);
|
||||
|
|
|
@ -219,8 +219,8 @@ static u32_t filter_remove(struct ll_filter *filter, u8_t addr_type,
|
|||
#if defined(CONFIG_BLUETOOTH_CONTROLLER_PRIVACY)
|
||||
bt_addr_t *ctrl_lrpa_get(u8_t rl_idx)
|
||||
{
|
||||
LL_ASSERT(rl_idx < ARRAY_SIZE(rl));
|
||||
if (!rl[rl_idx].lirk || !rl[rl_idx].rpas_ready) {
|
||||
if ((rl_idx >= ARRAY_SIZE(rl)) || !rl[rl_idx].lirk ||
|
||||
!rl[rl_idx].rpas_ready) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue