/* Free DSP Upper Instance */ static void esif_dsp_destroy(EsifDspPtr dspPtr) { if (NULL == dspPtr) { return; } esif_ht_destroy(dspPtr->ht_ptr, NULL); esif_link_list_destroy(dspPtr->algo_ptr); esif_link_list_destroy(dspPtr->domain_ptr); esif_link_list_destroy(dspPtr->cap_ptr); esif_link_list_destroy(dspPtr->evt_ptr); esif_ccb_free(dspPtr); }
/* Create Hash Table */ struct esif_ht * esif_ht_create( u32 size ) { u32 index = 0; struct esif_ht *new_ht_ptr = NULL; new_ht_ptr = (struct esif_ht *) esif_ccb_mempool_zalloc(ESIF_MEMPOOL_TYPE_HASH2); if (NULL == new_ht_ptr) { ESIF_TRACE_ERROR("Cannot allocate mem for hash table\n"); ESIF_ASSERT(ESIF_FALSE); goto exit; } new_ht_ptr->size = size; new_ht_ptr->table = (struct esif_link_list **) esif_ccb_malloc(sizeof(*new_ht_ptr->table) * size); if (new_ht_ptr->table == NULL) { esif_ccb_mempool_free(ESIF_MEMPOOL_TYPE_HASH2, new_ht_ptr); new_ht_ptr = NULL; goto exit; } for (index = 0; index < size; ++index) { ESIF_TRACE_DYN_VERB("Create linked list %d\n", index); new_ht_ptr->table[index] = esif_link_list_create(); if (new_ht_ptr->table[index] == NULL) { ESIF_TRACE_DYN_VERB("Creation failed\n"); esif_ht_destroy(new_ht_ptr, NULL); new_ht_ptr = NULL; goto exit; } } ESIF_TRACE_DYN_VERB("Have hash table %p\n", new_ht_ptr); exit: return new_ht_ptr; }