kopia lustrzana https://github.com/espressif/esp-idf
components/bt: Fix abort if call esp_spp_deinit without calling esp_spp_init
rodzic
e1592c8c81
commit
db6b210a5f
|
@ -315,6 +315,7 @@ static void btc_spp_init(btc_spp_args_t *arg)
|
||||||
{
|
{
|
||||||
if (osi_mutex_new(&spp_local_param.spp_slot_mutex) != 0) {
|
if (osi_mutex_new(&spp_local_param.spp_slot_mutex) != 0) {
|
||||||
BTC_TRACE_ERROR("%s osi_mutex_new failed\n", __func__);
|
BTC_TRACE_ERROR("%s osi_mutex_new failed\n", __func__);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
spp_local_param.spp_mode = arg->init.mode;
|
spp_local_param.spp_mode = arg->init.mode;
|
||||||
spp_local_param.spp_slot_id = 0;
|
spp_local_param.spp_slot_id = 0;
|
||||||
|
@ -323,6 +324,10 @@ static void btc_spp_init(btc_spp_args_t *arg)
|
||||||
|
|
||||||
static void btc_spp_uninit(void)
|
static void btc_spp_uninit(void)
|
||||||
{
|
{
|
||||||
|
if (!spp_local_param.spp_slot_mutex) {
|
||||||
|
BTC_TRACE_ERROR("%s SPP have not been init\n", __func__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
osi_mutex_lock(&spp_local_param.spp_slot_mutex, OSI_MUTEX_MAX_TIMEOUT);
|
osi_mutex_lock(&spp_local_param.spp_slot_mutex, OSI_MUTEX_MAX_TIMEOUT);
|
||||||
for (size_t i = 1; i <= BTA_JV_MAX_RFC_SR_SESSION; i++) {
|
for (size_t i = 1; i <= BTA_JV_MAX_RFC_SR_SESSION; i++) {
|
||||||
if (spp_local_param.spp_slots[i] != NULL && spp_local_param.spp_slots[i]->connected) {
|
if (spp_local_param.spp_slots[i] != NULL && spp_local_param.spp_slots[i]->connected) {
|
||||||
|
|
Ładowanie…
Reference in New Issue