Skip to content

Commit

Permalink
Replace all assert() with DEBUGASSERT()
Browse files Browse the repository at this point in the history
  • Loading branch information
acassis authored and xiaoxiang781216 committed Nov 22, 2020
1 parent 3352d38 commit 31c1472
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions arch/xtensa/src/esp32/esp32_himem.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ static bool allocate_blocks(int count, uint16_t *blocks_out)
for (i = 0; i < count; i++)
{
g_ram_descriptor[blocks_out[i]].is_alloced = true;
assert(g_ram_descriptor[blocks_out[i]].is_mapped == false);
DEBUGASSERT(g_ram_descriptor[blocks_out[i]].is_mapped == false);
}

return true;
Expand Down Expand Up @@ -496,11 +496,12 @@ int esp_himem_free_map_range(esp_himem_rangehandle_t handle)

for (i = 0; i < handle->block_ct; i++)
{
assert(rangeblock_idx_valid(handle->block_start + i));
DEBUGASSERT(rangeblock_idx_valid(handle->block_start + i));

/* should be allocated, if handle is valid */

assert(g_range_descriptor[i + handle->block_start].is_alloced == 1);
DEBUGASSERT(g_range_descriptor[i + \
handle->block_start].is_alloced == 1);

HIMEM_CHECK(g_range_descriptor[i + handle->block_start].is_mapped,
"memory still mapped to range", -EINVAL);
Expand Down Expand Up @@ -575,7 +576,7 @@ int esp_himem_map(esp_himem_handle_t handle,

for (i = 0; i < blockcount; i++)
{
assert(ramblock_idx_valid(handle->block[i + ram_block]));
DEBUGASSERT(ramblock_idx_valid(handle->block[i + ram_block]));
g_ram_descriptor[handle->block[i + ram_block]].is_mapped = 1;
g_range_descriptor[range->block_start + i + range_block].is_mapped = 1;
g_range_descriptor[range->block_start + i + range_block].ram_block =
Expand Down Expand Up @@ -630,7 +631,7 @@ int esp_himem_unmap(esp_himem_rangehandle_t range, void *ptr,
int ramblock = g_range_descriptor[range->block_start + i +
range_block].ram_block;

assert(ramblock_idx_valid(ramblock));
DEBUGASSERT(ramblock_idx_valid(ramblock));
g_ram_descriptor[ramblock].is_mapped = 0;
g_range_descriptor[range->block_start + i + range_block].is_mapped = 0;
}
Expand Down

0 comments on commit 31c1472

Please sign in to comment.