@@ -2731,6 +2731,11 @@ static void big_disconnect(struct bt_iso_big *big, uint8_t reason)
2731
2731
bt_iso_chan_disconnected (bis , reason );
2732
2732
}
2733
2733
2734
+ /* Cleanup the BIG before calling the `stopped` so that the `big` pointer and the ISO
2735
+ * channels in the `big` can be reused in the callback
2736
+ */
2737
+ cleanup_big (big );
2738
+
2734
2739
if (!sys_slist_is_empty (& iso_big_cbs )) {
2735
2740
struct bt_iso_big_cb * listener ;
2736
2741
@@ -3147,7 +3152,6 @@ void hci_le_big_complete(struct net_buf *buf)
3147
3152
big = big_lookup_flag (BT_BIG_PENDING );
3148
3153
if (big ) {
3149
3154
big_disconnect (big , evt -> status ? evt -> status : BT_HCI_ERR_UNSPECIFIED );
3150
- cleanup_big (big );
3151
3155
}
3152
3156
3153
3157
return ;
@@ -3165,7 +3169,6 @@ void hci_le_big_complete(struct net_buf *buf)
3165
3169
big -> num_bis );
3166
3170
}
3167
3171
big_disconnect (big , evt -> status ? evt -> status : BT_HCI_ERR_UNSPECIFIED );
3168
- cleanup_big (big );
3169
3172
return ;
3170
3173
}
3171
3174
@@ -3205,7 +3208,6 @@ void hci_le_big_terminate(struct net_buf *buf)
3205
3208
LOG_DBG ("BIG[%u] %p terminated" , big -> handle , big );
3206
3209
3207
3210
big_disconnect (big , evt -> reason );
3208
- cleanup_big (big );
3209
3211
}
3210
3212
#endif /* CONFIG_BT_ISO_BROADCASTER */
3211
3213
@@ -3292,7 +3294,6 @@ int bt_iso_big_terminate(struct bt_iso_big *big)
3292
3294
3293
3295
if (!err ) {
3294
3296
big_disconnect (big , BT_HCI_ERR_LOCALHOST_TERM_CONN );
3295
- cleanup_big (big );
3296
3297
}
3297
3298
} else {
3298
3299
err = - EINVAL ;
@@ -3337,7 +3338,6 @@ void hci_le_big_sync_established(struct net_buf *buf)
3337
3338
big = big_lookup_flag (BT_BIG_SYNCING );
3338
3339
if (big ) {
3339
3340
big_disconnect (big , evt -> status ? evt -> status : BT_HCI_ERR_UNSPECIFIED );
3340
- cleanup_big (big );
3341
3341
}
3342
3342
3343
3343
return ;
@@ -3355,7 +3355,6 @@ void hci_le_big_sync_established(struct net_buf *buf)
3355
3355
big -> num_bis );
3356
3356
}
3357
3357
big_disconnect (big , evt -> status ? evt -> status : BT_HCI_ERR_UNSPECIFIED );
3358
- cleanup_big (big );
3359
3358
return ;
3360
3359
}
3361
3360
@@ -3395,7 +3394,6 @@ void hci_le_big_sync_lost(struct net_buf *buf)
3395
3394
LOG_DBG ("BIG[%u] %p sync lost" , big -> handle , big );
3396
3395
3397
3396
big_disconnect (big , evt -> reason );
3398
- cleanup_big (big );
3399
3397
}
3400
3398
3401
3399
static int hci_le_big_create_sync (const struct bt_le_per_adv_sync * sync , struct bt_iso_big * big ,
@@ -3587,7 +3585,6 @@ void bt_iso_reset(void)
3587
3585
struct bt_iso_big * big = & bigs [i ];
3588
3586
3589
3587
big_disconnect (big , BT_HCI_ERR_UNSPECIFIED );
3590
- cleanup_big (big );
3591
3588
}
3592
3589
#endif /* CONFIG_BT_ISO_BROADCAST */
3593
3590
}
0 commit comments