@@ -2724,7 +2724,10 @@ static void big_disconnect(struct bt_iso_big *big, uint8_t reason)
2724
2724
bt_iso_chan_disconnected (bis , reason );
2725
2725
}
2726
2726
2727
- atomic_clear_bit (big -> flags , BT_BIG_BUSY );
2727
+ /* Cleanup the BIG before calling the `stopped` so that the `big` pointer and the ISO
2728
+ * channels in the `big` can be reused in the callback
2729
+ */
2730
+ cleanup_big (big );
2728
2731
2729
2732
if (!sys_slist_is_empty (& iso_big_cbs )) {
2730
2733
struct bt_iso_big_cb * listener ;
@@ -3162,7 +3165,6 @@ void hci_le_big_complete(struct net_buf *buf)
3162
3165
big = big_lookup_flag (BT_BIG_PENDING );
3163
3166
if (big ) {
3164
3167
big_disconnect (big , evt -> status ? evt -> status : BT_HCI_ERR_UNSPECIFIED );
3165
- cleanup_big (big );
3166
3168
}
3167
3169
3168
3170
return ;
@@ -3180,7 +3182,6 @@ void hci_le_big_complete(struct net_buf *buf)
3180
3182
big -> num_bis );
3181
3183
}
3182
3184
big_disconnect (big , evt -> status ? evt -> status : BT_HCI_ERR_UNSPECIFIED );
3183
- cleanup_big (big );
3184
3185
return ;
3185
3186
}
3186
3187
@@ -3223,7 +3224,6 @@ void hci_le_big_terminate(struct net_buf *buf)
3223
3224
LOG_DBG ("BIG[%u] %p terminated" , big -> handle , big );
3224
3225
3225
3226
big_disconnect (big , evt -> reason );
3226
- cleanup_big (big );
3227
3227
}
3228
3228
#endif /* CONFIG_BT_ISO_BROADCASTER */
3229
3229
@@ -3315,7 +3315,6 @@ int bt_iso_big_terminate(struct bt_iso_big *big)
3315
3315
3316
3316
if (!err ) {
3317
3317
big_disconnect (big , BT_HCI_ERR_LOCALHOST_TERM_CONN );
3318
- cleanup_big (big );
3319
3318
}
3320
3319
} else {
3321
3320
err = - EINVAL ;
@@ -3364,7 +3363,6 @@ void hci_le_big_sync_established(struct net_buf *buf)
3364
3363
big = big_lookup_flag (BT_BIG_SYNCING );
3365
3364
if (big ) {
3366
3365
big_disconnect (big , evt -> status ? evt -> status : BT_HCI_ERR_UNSPECIFIED );
3367
- cleanup_big (big );
3368
3366
}
3369
3367
3370
3368
return ;
@@ -3382,7 +3380,6 @@ void hci_le_big_sync_established(struct net_buf *buf)
3382
3380
big -> num_bis );
3383
3381
}
3384
3382
big_disconnect (big , evt -> status ? evt -> status : BT_HCI_ERR_UNSPECIFIED );
3385
- cleanup_big (big );
3386
3383
return ;
3387
3384
}
3388
3385
@@ -3425,7 +3422,6 @@ void hci_le_big_sync_lost(struct net_buf *buf)
3425
3422
LOG_DBG ("BIG[%u] %p sync lost" , big -> handle , big );
3426
3423
3427
3424
big_disconnect (big , evt -> reason );
3428
- cleanup_big (big );
3429
3425
}
3430
3426
3431
3427
static int hci_le_big_create_sync (const struct bt_le_per_adv_sync * sync , struct bt_iso_big * big ,
@@ -3636,7 +3632,6 @@ void bt_iso_reset(void)
3636
3632
struct bt_iso_big * big = & bigs [i ];
3637
3633
3638
3634
big_disconnect (big , BT_HCI_ERR_UNSPECIFIED );
3639
- cleanup_big (big );
3640
3635
}
3641
3636
#endif /* CONFIG_BT_ISO_BROADCAST */
3642
3637
}
0 commit comments