@@ -2719,6 +2719,11 @@ static void big_disconnect(struct bt_iso_big *big, uint8_t reason)
2719
2719
bt_iso_chan_disconnected (bis , reason );
2720
2720
}
2721
2721
2722
+ /* Cleanup the BIG before calling the `stopped` so that the `big` pointer and the ISO
2723
+ * channels in the `big` can be reused in the callback
2724
+ */
2725
+ cleanup_big (big );
2726
+
2722
2727
if (!sys_slist_is_empty (& iso_big_cbs )) {
2723
2728
struct bt_iso_big_cb * listener ;
2724
2729
@@ -3135,7 +3140,6 @@ void hci_le_big_complete(struct net_buf *buf)
3135
3140
big = big_lookup_flag (BT_BIG_PENDING );
3136
3141
if (big ) {
3137
3142
big_disconnect (big , evt -> status ? evt -> status : BT_HCI_ERR_UNSPECIFIED );
3138
- cleanup_big (big );
3139
3143
}
3140
3144
3141
3145
return ;
@@ -3153,7 +3157,6 @@ void hci_le_big_complete(struct net_buf *buf)
3153
3157
big -> num_bis );
3154
3158
}
3155
3159
big_disconnect (big , evt -> status ? evt -> status : BT_HCI_ERR_UNSPECIFIED );
3156
- cleanup_big (big );
3157
3160
return ;
3158
3161
}
3159
3162
@@ -3193,7 +3196,6 @@ void hci_le_big_terminate(struct net_buf *buf)
3193
3196
LOG_DBG ("BIG[%u] %p terminated" , big -> handle , big );
3194
3197
3195
3198
big_disconnect (big , evt -> reason );
3196
- cleanup_big (big );
3197
3199
}
3198
3200
#endif /* CONFIG_BT_ISO_BROADCASTER */
3199
3201
@@ -3280,7 +3282,6 @@ int bt_iso_big_terminate(struct bt_iso_big *big)
3280
3282
3281
3283
if (!err ) {
3282
3284
big_disconnect (big , BT_HCI_ERR_LOCALHOST_TERM_CONN );
3283
- cleanup_big (big );
3284
3285
}
3285
3286
} else {
3286
3287
err = - EINVAL ;
@@ -3325,7 +3326,6 @@ void hci_le_big_sync_established(struct net_buf *buf)
3325
3326
big = big_lookup_flag (BT_BIG_SYNCING );
3326
3327
if (big ) {
3327
3328
big_disconnect (big , evt -> status ? evt -> status : BT_HCI_ERR_UNSPECIFIED );
3328
- cleanup_big (big );
3329
3329
}
3330
3330
3331
3331
return ;
@@ -3343,7 +3343,6 @@ void hci_le_big_sync_established(struct net_buf *buf)
3343
3343
big -> num_bis );
3344
3344
}
3345
3345
big_disconnect (big , evt -> status ? evt -> status : BT_HCI_ERR_UNSPECIFIED );
3346
- cleanup_big (big );
3347
3346
return ;
3348
3347
}
3349
3348
@@ -3383,7 +3382,6 @@ void hci_le_big_sync_lost(struct net_buf *buf)
3383
3382
LOG_DBG ("BIG[%u] %p sync lost" , big -> handle , big );
3384
3383
3385
3384
big_disconnect (big , evt -> reason );
3386
- cleanup_big (big );
3387
3385
}
3388
3386
3389
3387
static int hci_le_big_create_sync (const struct bt_le_per_adv_sync * sync , struct bt_iso_big * big ,
@@ -3575,7 +3573,6 @@ void bt_iso_reset(void)
3575
3573
struct bt_iso_big * big = & bigs [i ];
3576
3574
3577
3575
big_disconnect (big , BT_HCI_ERR_UNSPECIFIED );
3578
- cleanup_big (big );
3579
3576
}
3580
3577
#endif /* CONFIG_BT_ISO_BROADCAST */
3581
3578
}
0 commit comments