Skip to content

Commit 12ba459

Browse files
cvinayakcarlescufi
authored andcommitted
Bluetooth: controller: Minor improvements to ext header population
Minor refactor and improvement to common extended header population. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent 0de4c30 commit 12ba459

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

subsys/bluetooth/controller/hci/hci.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5358,12 +5358,12 @@ static void le_per_adv_sync_report(struct pdu_data *pdu_data,
53585358
p->ext_hdr_len);
53595359

53605360
if (!p->ext_hdr_len) {
5361-
hdr_len = ptr - (uint8_t *)p;
5361+
hdr_len = PDU_AC_EXT_HEADER_SIZE_MIN;
53625362

53635363
goto no_ext_hdr;
53645364
}
53655365

5366-
ptr += sizeof(*h);
5366+
ptr = h->data;
53675367

53685368
/* No AdvA */
53695369
/* No TargetA */

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,13 @@ static int prepare_cb(struct lll_prepare_param *p)
214214
pri_hdr = (void *)pri_com_hdr->ext_hdr_adv_data;
215215
pri_dptr = pri_hdr->data;
216216

217+
/* NOTE: We shall be here in auxiliary PDU prepare due to
218+
* aux_ptr flag being set in the extended common header
219+
* flags. Hence, ext_hdr_len is non-zero, an explicit check
220+
* is not needed.
221+
*/
222+
LL_ASSERT(pri_com_hdr->ext_hdr_len);
223+
217224
/* traverse through adv_addr, if present */
218225
if (pri_hdr->adv_addr) {
219226
pri_dptr += BDADDR_SIZE;

subsys/bluetooth/controller/ll_sw/ull_adv.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -393,11 +393,11 @@ uint8_t ll_adv_params_set(uint16_t interval, uint8_t adv_type,
393393

394394
/* Zero-init header flags */
395395
if (is_pdu_type_changed) {
396-
*(uint8_t *)&pri_hdr_prev = 0;
396+
*(uint8_t *)&pri_hdr_prev = 0U;
397397
} else {
398-
*(uint8_t *)&pri_hdr_prev = *(uint8_t *)pri_hdr;
398+
pri_hdr_prev = *pri_hdr;
399399
}
400-
*(uint8_t *)pri_hdr = 0;
400+
*(uint8_t *)pri_hdr = 0U;
401401

402402
/* AdvA flag */
403403
if (pri_hdr_prev.adv_addr) {

0 commit comments

Comments
 (0)