fix(nimble): Fix host init assert when periodic sync is disabled

This commit is contained in:
Shreeyash
2026-01-29 18:30:11 +05:30
committed by Rahul Tank
parent 4ea7586add
commit d8e5977c04
3 changed files with 17 additions and 4 deletions
+1 -1
View File
@@ -648,7 +648,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) {
+15 -2
View File
@@ -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)
{
+1 -1
View File
@@ -580,7 +580,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);