mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-06-05 21:04:49 +00:00
fix(nimble): Fix host init assert when periodic sync is disabled
This commit is contained in:
@@ -639,7 +639,7 @@ ble_hs_conn_init(void)
|
||||
#if !MYNEWT_VAL(MP_RUNTIME_ALLOC)
|
||||
size_t elem_mem_size = OS_MEMPOOL_SIZE(MYNEWT_VAL(BLE_MAX_CONNECTIONS), sizeof(struct ble_hs_conn));
|
||||
|
||||
if (!ble_hs_conn_elem_mem) {
|
||||
if (!ble_hs_conn_elem_mem && elem_mem_size != 0) {
|
||||
ble_hs_conn_elem_mem = (os_membuf_t *)nimble_platform_mem_calloc(1,elem_mem_size * sizeof(os_membuf_t));
|
||||
|
||||
if (!ble_hs_conn_elem_mem) {
|
||||
|
||||
@@ -197,11 +197,24 @@ ble_hs_periodic_sync_init(void)
|
||||
|
||||
#if MYNEWT_VAL(BLE_STATIC_TO_DYNAMIC)
|
||||
rc = ble_hs_periodic_sync_ensure_ctx();
|
||||
if (rc != 0)
|
||||
{
|
||||
if (rc != 0) {
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (MYNEWT_VAL(BLE_MAX_PERIODIC_SYNCS) == 0) {
|
||||
memset(&ble_hs_periodic_sync_pool, 0, sizeof(ble_hs_periodic_sync_pool));
|
||||
rc = os_mempool_init(&ble_hs_periodic_sync_pool, 0,
|
||||
sizeof(struct ble_hs_periodic_sync), NULL,
|
||||
"ble_hs_periodic_disc_pool");
|
||||
if (rc != 0) {
|
||||
return BLE_HS_EOS;
|
||||
}
|
||||
SLIST_INIT(&g_ble_hs_periodic_sync_handles);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if MYNEWT_VAL(BLE_STATIC_TO_DYNAMIC)
|
||||
#if !MYNEWT_VAL(MP_RUNTIME_ALLOC)
|
||||
if (!ble_hs_psync_elem_mem)
|
||||
{
|
||||
|
||||
@@ -511,7 +511,7 @@ ble_l2cap_init(void)
|
||||
size_t chan_mem_bytes = OS_MEMPOOL_SIZE(MYNEWT_VAL(BLE_L2CAP_MAX_CHANS) +
|
||||
MYNEWT_VAL(BLE_L2CAP_COC_MAX_NUM),
|
||||
sizeof (struct ble_l2cap_chan)) * sizeof(os_membuf_t);
|
||||
if (ble_l2cap_chan_mem == NULL) {
|
||||
if (ble_l2cap_chan_mem == NULL && chan_mem_bytes != 0) {
|
||||
ble_l2cap_chan_mem = (os_membuf_t *)nimble_platform_mem_calloc(1, chan_mem_bytes);
|
||||
if (ble_l2cap_chan_mem == NULL) {
|
||||
nimble_platform_mem_free(ble_l2cap_ctx);
|
||||
|
||||
Reference in New Issue
Block a user