mirror of https://github.com/thesofproject/sof.git
vmh: fix array update for contiguous allocation
Array holding sizes of allocations was not updated correctly this fixes array update issue. Signed-off-by: Jakub Dabek <jakub.dabek@intel.com>
This commit is contained in:
parent
f8d5ffb843
commit
4189f09b69
|
@ -495,7 +495,7 @@ int vmh_free(struct vmh_heap *heap, void *ptr)
|
||||||
|
|
||||||
size_t mem_block_iter, i, size_to_free, block_size, ptr_bit_array_offset,
|
size_t mem_block_iter, i, size_to_free, block_size, ptr_bit_array_offset,
|
||||||
ptr_bit_array_position, physical_block_count,
|
ptr_bit_array_position, physical_block_count,
|
||||||
check_offset, check_position, check_size;
|
check_offset, check_position, check_size, blocks_to_free;
|
||||||
uintptr_t phys_aligned_ptr, phys_aligned_alloc_end, phys_block_ptr;
|
uintptr_t phys_aligned_ptr, phys_aligned_alloc_end, phys_block_ptr;
|
||||||
bool ptr_range_found;
|
bool ptr_range_found;
|
||||||
|
|
||||||
|
@ -581,10 +581,13 @@ int vmh_free(struct vmh_heap *heap, void *ptr)
|
||||||
*/
|
*/
|
||||||
size_to_free = block_size;
|
size_to_free = block_size;
|
||||||
}
|
}
|
||||||
|
blocks_to_free = size_to_free / block_size;
|
||||||
retval = sys_mem_blocks_free_contiguous(
|
retval = sys_mem_blocks_free_contiguous(
|
||||||
heap->physical_blocks_allocators[mem_block_iter], ptr,
|
heap->physical_blocks_allocators[mem_block_iter], ptr,
|
||||||
size_to_free / block_size);
|
blocks_to_free);
|
||||||
|
if (!retval)
|
||||||
|
sys_bitarray_clear_region(heap->allocation_sizes[mem_block_iter],
|
||||||
|
blocks_to_free, ptr_bit_array_position);
|
||||||
} else {
|
} else {
|
||||||
retval = sys_mem_blocks_free(heap->physical_blocks_allocators[mem_block_iter],
|
retval = sys_mem_blocks_free(heap->physical_blocks_allocators[mem_block_iter],
|
||||||
1, &ptr);
|
1, &ptr);
|
||||||
|
|
Loading…
Reference in New Issue