mirror of https://github.com/thesofproject/sof.git
vmh: fix allocation size check
When using non contiguous allocation block size is calculated after the check. Signed-off-by: Jakub Dabek <jakub.dabek@intel.com>
This commit is contained in:
parent
0fee9d9630
commit
f23827a203
|
@ -263,9 +263,6 @@ void *vmh_alloc(struct vmh_heap *heap, uint32_t alloc_size)
|
||||||
if (!heap->physical_blocks_allocators[mem_block_iterator])
|
if (!heap->physical_blocks_allocators[mem_block_iterator])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* If we do not span alloc and block is smaller than alloc we try next mem_block */
|
|
||||||
if (block_size < alloc_size && !heap->allocating_continuously)
|
|
||||||
continue;
|
|
||||||
/* calculate block count needed to allocate for current
|
/* calculate block count needed to allocate for current
|
||||||
* mem_block.
|
* mem_block.
|
||||||
*/
|
*/
|
||||||
|
@ -273,6 +270,10 @@ void *vmh_alloc(struct vmh_heap *heap, uint32_t alloc_size)
|
||||||
1 << heap->physical_blocks_allocators[mem_block_iterator]->info.blk_sz_shift;
|
1 << heap->physical_blocks_allocators[mem_block_iterator]->info.blk_sz_shift;
|
||||||
block_count = SOF_DIV_ROUND_UP((uint64_t)alloc_size, (uint64_t)block_size);
|
block_count = SOF_DIV_ROUND_UP((uint64_t)alloc_size, (uint64_t)block_size);
|
||||||
|
|
||||||
|
/* If we do not span alloc and block is smaller than alloc we try next mem_block */
|
||||||
|
if (block_size < alloc_size && !heap->allocating_continuously)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (block_count >
|
if (block_count >
|
||||||
heap->physical_blocks_allocators[mem_block_iterator]->info.num_blocks)
|
heap->physical_blocks_allocators[mem_block_iterator]->info.num_blocks)
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in New Issue