lib: mempool: Return error if no block found

Return -ENOMEM if no block is available on any level.

Fixes: #14504

Signed-off-by: Pawel Dunaj <pawel.dunaj@nordicsemi.no>
This commit is contained in:
Pawel Dunaj 2019-03-15 16:16:16 +01:00 committed by Kumar Gala
parent 94ae61f765
commit 2c7d68009a

View file

@ -299,9 +299,14 @@ int z_sys_mem_pool_block_alloc(struct sys_mem_pool_base *p, size_t size,
}
pool_irq_unlock(p, key);
*data_p = data;
if (data == NULL) {
return -ENOMEM;
}
*level_p = alloc_l;
*block_p = block_num(p, data, lsizes[alloc_l]);
*data_p = data;
return 0;
}