@@ -2722,6 +2722,11 @@ static void big_disconnect(struct bt_iso_big *big, uint8_t reason)
2722
2722
bt_iso_chan_disconnected (bis , reason );
2723
2723
}
2724
2724
2725
+ /* Cleanup the BIG before calling the `stopped` so that the `big` pointer and the ISO
2726
+ * channels in the `big` can be reused in the callback
2727
+ */
2728
+ cleanup_big (big );
2729
+
2725
2730
if (!sys_slist_is_empty (& iso_big_cbs )) {
2726
2731
struct bt_iso_big_cb * listener ;
2727
2732
@@ -3158,7 +3163,6 @@ void hci_le_big_complete(struct net_buf *buf)
3158
3163
big = big_lookup_flag (BT_BIG_PENDING );
3159
3164
if (big ) {
3160
3165
big_disconnect (big , evt -> status ? evt -> status : BT_HCI_ERR_UNSPECIFIED );
3161
- cleanup_big (big );
3162
3166
}
3163
3167
3164
3168
return ;
@@ -3176,7 +3180,6 @@ void hci_le_big_complete(struct net_buf *buf)
3176
3180
big -> num_bis );
3177
3181
}
3178
3182
big_disconnect (big , evt -> status ? evt -> status : BT_HCI_ERR_UNSPECIFIED );
3179
- cleanup_big (big );
3180
3183
return ;
3181
3184
}
3182
3185
@@ -3216,7 +3219,6 @@ void hci_le_big_terminate(struct net_buf *buf)
3216
3219
LOG_DBG ("BIG[%u] %p terminated" , big -> handle , big );
3217
3220
3218
3221
big_disconnect (big , evt -> reason );
3219
- cleanup_big (big );
3220
3222
}
3221
3223
#endif /* CONFIG_BT_ISO_BROADCASTER */
3222
3224
@@ -3303,7 +3305,6 @@ int bt_iso_big_terminate(struct bt_iso_big *big)
3303
3305
3304
3306
if (!err ) {
3305
3307
big_disconnect (big , BT_HCI_ERR_LOCALHOST_TERM_CONN );
3306
- cleanup_big (big );
3307
3308
}
3308
3309
} else {
3309
3310
err = - EINVAL ;
@@ -3352,7 +3353,6 @@ void hci_le_big_sync_established(struct net_buf *buf)
3352
3353
big = big_lookup_flag (BT_BIG_SYNCING );
3353
3354
if (big ) {
3354
3355
big_disconnect (big , evt -> status ? evt -> status : BT_HCI_ERR_UNSPECIFIED );
3355
- cleanup_big (big );
3356
3356
}
3357
3357
3358
3358
return ;
@@ -3370,7 +3370,6 @@ void hci_le_big_sync_established(struct net_buf *buf)
3370
3370
big -> num_bis );
3371
3371
}
3372
3372
big_disconnect (big , evt -> status ? evt -> status : BT_HCI_ERR_UNSPECIFIED );
3373
- cleanup_big (big );
3374
3373
return ;
3375
3374
}
3376
3375
@@ -3410,7 +3409,6 @@ void hci_le_big_sync_lost(struct net_buf *buf)
3410
3409
LOG_DBG ("BIG[%u] %p sync lost" , big -> handle , big );
3411
3410
3412
3411
big_disconnect (big , evt -> reason );
3413
- cleanup_big (big );
3414
3412
}
3415
3413
3416
3414
static int hci_le_big_create_sync (const struct bt_le_per_adv_sync * sync , struct bt_iso_big * big ,
@@ -3621,7 +3619,6 @@ void bt_iso_reset(void)
3621
3619
struct bt_iso_big * big = & bigs [i ];
3622
3620
3623
3621
big_disconnect (big , BT_HCI_ERR_UNSPECIFIED );
3624
- cleanup_big (big );
3625
3622
}
3626
3623
#endif /* CONFIG_BT_ISO_BROADCAST */
3627
3624
}
0 commit comments