Skip to content

Commit 7d9235d

Browse files
committed
Bluetooth: Controller: Revert use of Rule 85 MISRA-C-2012 R_14_04
Use of explicit `conn != NULL` increases code size, hence revert previous commit to optimize code size. Build command: cmake -GNinja -DBOARD=nrf52833dk/nrf52833 -DEXTRA_CONF_FILE=overlay-all-bt_ll_sw_split.conf -DDTC_OVERLAY_FILE=boards/nrf52833dk_nrf52833_df.overlay -DSNIPPET="bt-ll-sw-split" ../../samples/bluetooth/hci_uart ninja Memory region Used Size Region Size %age Used FLASH: 284992 B 512 KB 54.36% RAM: 109752 B 128 KB 83.73% IDT_LIST: 0 GB 32 KB 0.00% Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent a65baff commit 7d9235d

File tree

8 files changed

+33
-33
lines changed

8 files changed

+33
-33
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ static int prepare_cb(struct lll_prepare_param *p)
155155

156156
/* Get reference to ACL context */
157157
conn_lll = ull_conn_lll_get(cis_lll->acl_handle);
158-
LL_ASSERT(conn_lll != NULL);
158+
LL_ASSERT(conn_lll);
159159

160160
/* Pick the event_count calculated in the ULL prepare */
161161
cis_lll->event_count = cis_lll->event_count_prepare;
@@ -434,7 +434,7 @@ static void abort_cb(struct lll_prepare_param *prepare_param, void *param)
434434
/* Get reference to ACL context */
435435
const struct lll_conn *conn_lll = ull_conn_lll_get(cis_lll->acl_handle);
436436

437-
LL_ASSERT(conn_lll != NULL);
437+
LL_ASSERT(conn_lll);
438438

439439
if (conn_lll->enc_rx) {
440440
radio_ccm_disable();
@@ -483,7 +483,7 @@ static void isr_tx(void *param)
483483
/* Get reference to ACL context */
484484
const struct lll_conn *conn_lll = ull_conn_lll_get(cis_lll->acl_handle);
485485

486-
LL_ASSERT(conn_lll != NULL);
486+
LL_ASSERT(conn_lll);
487487
#endif /* CONFIG_BT_CTLR_LE_ENC */
488488

489489
/* PHY */
@@ -589,7 +589,7 @@ static void isr_tx(void *param)
589589

590590
/* Get reference to ACL context */
591591
evt_conn_lll = ull_conn_lll_get(cis_lll->acl_handle);
592-
LL_ASSERT(evt_conn_lll != NULL);
592+
LL_ASSERT(evt_conn_lll);
593593

594594
/* Calculate the radio channel to use for next subevent */
595595
data_chan_id = lll_chan_id(cis_lll->access_addr);
@@ -636,7 +636,7 @@ static void isr_tx(void *param)
636636

637637
/* Get reference to ACL context */
638638
next_conn_lll = ull_conn_lll_get(next_cis_lll->acl_handle);
639-
LL_ASSERT(next_conn_lll != NULL);
639+
LL_ASSERT(next_conn_lll);
640640

641641
/* Calculate the radio channel to use for ISO event */
642642
data_chan_id = lll_chan_id(next_cis_lll->access_addr);
@@ -777,7 +777,7 @@ static void isr_rx(void *param)
777777
/* Get reference to ACL context */
778778
const struct lll_conn *conn_lll = ull_conn_lll_get(cis_lll->acl_handle);
779779

780-
LL_ASSERT(conn_lll != NULL);
780+
LL_ASSERT(conn_lll);
781781

782782
/* If required, wait for CCM to finish
783783
*/
@@ -866,7 +866,7 @@ static void isr_rx(void *param)
866866

867867
/* Get reference to ACL context */
868868
next_conn_lll = ull_conn_lll_get(next_cis_lll->acl_handle);
869-
LL_ASSERT(next_conn_lll != NULL);
869+
LL_ASSERT(next_conn_lll);
870870

871871
/* Calculate CIS channel if not already calculated */
872872
if (se_curr < cis_lll->nse) {
@@ -1043,7 +1043,7 @@ static void isr_prepare_subevent(void *param)
10431043
/* Get reference to ACL context */
10441044
const struct lll_conn *conn_lll = ull_conn_lll_get(cis_lll->acl_handle);
10451045

1046-
LL_ASSERT(conn_lll != NULL);
1046+
LL_ASSERT(conn_lll);
10471047
#endif /* CONFIG_BT_CTLR_LE_ENC */
10481048

10491049
/* PHY */

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ static int prepare_cb(struct lll_prepare_param *p)
169169

170170
/* Get reference to ACL context */
171171
conn_lll = ull_conn_lll_get(cis_lll->acl_handle);
172-
LL_ASSERT(conn_lll != NULL);
172+
LL_ASSERT(conn_lll);
173173

174174
/* Pick the event_count calculated in the ULL prepare */
175175
cis_lll->event_count = cis_lll->event_count_prepare;
@@ -450,7 +450,7 @@ static void abort_cb(struct lll_prepare_param *prepare_param, void *param)
450450
/* Get reference to ACL context */
451451
const struct lll_conn *conn_lll = ull_conn_lll_get(cis_lll->acl_handle);
452452

453-
LL_ASSERT(conn_lll != NULL);
453+
LL_ASSERT(conn_lll);
454454

455455
if (conn_lll->enc_rx) {
456456
radio_ccm_disable();
@@ -566,7 +566,7 @@ static void isr_rx(void *param)
566566

567567
/* Get reference to ACL context */
568568
conn_lll = ull_conn_lll_get(cis_lll->acl_handle);
569-
LL_ASSERT(conn_lll != NULL);
569+
LL_ASSERT(conn_lll);
570570

571571
if (crc_ok) {
572572
struct node_rx_pdu *node_rx;
@@ -881,7 +881,7 @@ static void isr_tx(void *param)
881881
/* Get reference to ACL context */
882882
const struct lll_conn *conn_lll = ull_conn_lll_get(cis_lll->acl_handle);
883883

884-
LL_ASSERT(conn_lll != NULL);
884+
LL_ASSERT(conn_lll);
885885
#endif /* CONFIG_BT_CTLR_LE_ENC */
886886

887887
/* PHY */
@@ -1046,7 +1046,7 @@ static void isr_prepare_subevent(void *param)
10461046

10471047
/* Get reference to ACL context */
10481048
conn_lll = ull_conn_lll_get(cis_lll->acl_handle);
1049-
LL_ASSERT(conn_lll != NULL);
1049+
LL_ASSERT(conn_lll);
10501050

10511051
/* Calculate the radio channel to use for next subevent
10521052
*/
@@ -1072,7 +1072,7 @@ static void isr_prepare_subevent_next_cis(void *param)
10721072

10731073
/* Get reference to ACL context */
10741074
conn_lll = ull_conn_lll_get(cis_lll->acl_handle);
1075-
LL_ASSERT(conn_lll != NULL);
1075+
LL_ASSERT(conn_lll);
10761076

10771077
/* Event counter value, 0-15 bit of cisEventCounter */
10781078
event_counter = cis_lll->event_count;
@@ -1110,7 +1110,7 @@ static void isr_prepare_subevent_common(void *param)
11101110
/* Get reference to ACL context */
11111111
const struct lll_conn *conn_lll = ull_conn_lll_get(cis_lll->acl_handle);
11121112

1113-
LL_ASSERT(conn_lll != NULL);
1113+
LL_ASSERT(conn_lll);
11141114
#endif /* CONFIG_BT_CTLR_LE_ENC */
11151115

11161116
/* PHY */

subsys/bluetooth/controller/ll_sw/ull.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1686,7 +1686,7 @@ void ll_rx_mem_release(void **node_rx)
16861686
memq_link_t *link;
16871687

16881688
conn = ll_conn_get(rx_free->hdr.handle);
1689-
LL_ASSERT(conn != NULL);
1689+
LL_ASSERT(conn);
16901690

16911691
LL_ASSERT(!conn->lll.link_tx_free);
16921692
link = memq_deinit(&conn->lll.memq_tx.head,
@@ -2869,7 +2869,7 @@ static inline void rx_demux_rx(memq_link_t *link, struct node_rx_hdr *rx)
28692869
(void)memq_dequeue(memq_ull_rx.tail, &memq_ull_rx.head, NULL);
28702870

28712871
conn = ll_conn_get(rx->handle);
2872-
LL_ASSERT(conn != NULL);
2872+
LL_ASSERT(conn);
28732873

28742874
if (ull_cp_cc_awaiting_established(conn)) {
28752875
ull_cp_cc_established(conn, BT_HCI_ERR_SUCCESS);

subsys/bluetooth/controller/ll_sw/ull_central_iso.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ uint8_t ull_central_iso_setup(uint16_t cis_handle,
859859

860860
/* ACL connection of the new CIS */
861861
conn = ll_conn_get(cis->lll.acl_handle);
862-
LL_ASSERT(conn != NULL);
862+
LL_ASSERT(conn);
863863

864864
#if defined(CONFIG_BT_CTLR_JIT_SCHEDULING)
865865
uint16_t event_counter;
@@ -983,7 +983,7 @@ int ull_central_iso_cis_offset_get(uint16_t cis_handle,
983983
LL_ASSERT(cis);
984984

985985
conn = ll_conn_get(cis->lll.acl_handle);
986-
LL_ASSERT(conn != NULL);
986+
LL_ASSERT(conn);
987987

988988
/* `ull_conn_llcp()` (caller of this function) is called before `ull_ref_inc()` hence we do
989989
* not need to use `ull_conn_event_counter()`.
@@ -1063,7 +1063,7 @@ static void mfy_cig_offset_get(void *param)
10631063
offset_min_us += cig->sync_delay - cis->sync_delay;
10641064

10651065
conn = ll_conn_get(cis->lll.acl_handle);
1066-
LL_ASSERT(conn != NULL);
1066+
LL_ASSERT(conn);
10671067

10681068
/* Ensure the offset is not greater than the ACL interval, considering
10691069
* the minimum CIS offset requirement.
@@ -1175,7 +1175,7 @@ static void mfy_cis_offset_get(void *param)
11751175
cig_remainder_us = remainder;
11761176

11771177
conn = ll_conn_get(cis->lll.acl_handle);
1178-
LL_ASSERT(conn != NULL);
1178+
LL_ASSERT(conn);
11791179

11801180
/* Add a tick for negative remainder and return positive remainder
11811181
* value.

subsys/bluetooth/controller/ll_sw/ull_conn.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ struct ll_conn *ll_connected_get(uint16_t handle)
192192
struct ll_conn *conn;
193193

194194
conn = ll_conn_get(handle);
195-
if ((conn == NULL) || (conn->lll.handle != handle)) {
195+
if (!conn || conn->lll.handle != handle) {
196196
return NULL;
197197
}
198198

@@ -446,7 +446,7 @@ uint8_t ll_terminate_ind_send(uint16_t handle, uint8_t reason)
446446

447447
} else if (cis->group->state == CIG_STATE_INITIATING) {
448448
conn = ll_connected_get(cis->lll.acl_handle);
449-
LL_ASSERT(conn != NULL);
449+
LL_ASSERT(conn);
450450

451451
/* CIS is not yet established - try to cancel procedure */
452452
if (ull_cp_cc_cancel(conn)) {
@@ -807,7 +807,7 @@ struct lll_conn *ull_conn_lll_get(uint16_t handle)
807807
struct ll_conn *conn;
808808

809809
conn = ll_conn_get(handle);
810-
if (conn == NULL) {
810+
if (!conn) {
811811
return NULL;
812812
}
813813

@@ -1558,7 +1558,7 @@ void ull_conn_tx_ack(uint16_t handle, memq_link_t *link, struct node_tx *tx)
15581558
if (handle != LLL_HANDLE_INVALID) {
15591559
struct ll_conn *conn = ll_conn_get(handle);
15601560

1561-
LL_ASSERT(conn != NULL);
1561+
LL_ASSERT(conn);
15621562

15631563
ull_cp_tx_ack(conn, tx);
15641564
}
@@ -1571,7 +1571,7 @@ void ull_conn_tx_ack(uint16_t handle, memq_link_t *link, struct node_tx *tx)
15711571
LL_ASSERT(link->next);
15721572

15731573
conn = ll_connected_get(handle);
1574-
LL_ASSERT(conn != NULL);
1574+
LL_ASSERT(conn);
15751575

15761576
ull_cp_release_tx(conn, tx);
15771577

@@ -1856,7 +1856,7 @@ static inline void disable(uint16_t handle)
18561856
int err;
18571857

18581858
conn = ll_conn_get(handle);
1859-
LL_ASSERT(conn != NULL);
1859+
LL_ASSERT(conn);
18601860

18611861
err = ull_ticker_stop_with_mark(TICKER_ID_CONN_BASE + handle,
18621862
conn, &conn->lll);

subsys/bluetooth/controller/ll_sw/ull_conn_iso.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ void ull_conn_iso_done(struct node_rx_event_done *done)
485485
if (!cis->event_expire) {
486486
struct ll_conn *conn = ll_conn_get(cis->lll.acl_handle);
487487

488-
LL_ASSERT(conn != NULL);
488+
LL_ASSERT(conn);
489489

490490
cis->event_expire = RADIO_CONN_EVENTS(
491491
conn->supervision_timeout * 10U * 1000U,
@@ -532,7 +532,7 @@ void ull_conn_iso_done(struct node_rx_event_done *done)
532532
struct ll_conn *conn;
533533

534534
conn = ll_connected_get(cis->lll.acl_handle);
535-
LL_ASSERT(conn != NULL);
535+
LL_ASSERT(conn);
536536

537537
ticker_status = ticker_update(TICKER_INSTANCE_ID_CTLR,
538538
TICKER_USER_ID_ULL_HIGH,
@@ -1257,7 +1257,7 @@ static void cis_disabled_cb(void *param)
12571257
ll_iso_stream_released_cb_t cis_released_cb;
12581258

12591259
conn = ll_conn_get(cis->lll.acl_handle);
1260-
LL_ASSERT(conn != NULL);
1260+
LL_ASSERT(conn);
12611261

12621262
cis_released_cb = cis->released_cb;
12631263
cis->released_cb = NULL;
@@ -1321,7 +1321,7 @@ static void cis_disabled_cb(void *param)
13211321
ll_rx_put_sched(node_terminate->hdr.link, node_terminate);
13221322
} else {
13231323
conn = ll_conn_get(cis->lll.acl_handle);
1324-
LL_ASSERT(conn != NULL);
1324+
LL_ASSERT(conn);
13251325

13261326
/* CIS was not established - complete the procedure with error */
13271327
if (ull_cp_cc_awaiting_established(conn)) {

subsys/bluetooth/controller/ll_sw/ull_iso.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2025,7 +2025,7 @@ void ull_iso_resume_ticker_start(struct lll_event *resume_event,
20252025
cis = ll_conn_iso_stream_get(stream_handle);
20262026

20272027
conn = ll_conn_get(cis->lll.acl_handle);
2028-
LL_ASSERT(conn != NULL);
2028+
LL_ASSERT(conn);
20292029

20302030
phy = conn->lll.phy_rx;
20312031
#endif /* CONFIG_BT_CTLR_CONN_ISO */

subsys/bluetooth/controller/ll_sw/ull_peripheral_iso.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ uint8_t ull_peripheral_iso_setup(struct pdu_data_llctrl_cis_ind *ind,
318318
}
319319

320320
conn = ll_conn_get(cis->lll.acl_handle);
321-
LL_ASSERT(conn != NULL);
321+
LL_ASSERT(conn);
322322

323323
cis_offset = sys_get_le24(ind->cis_offset);
324324

0 commit comments

Comments
 (0)