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:
parent
94ae61f765
commit
2c7d68009a
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue