kernel: kheap: fix k_heap_aligned_alloc handling of K_FOREVER
k_heap_aligned_alloc was not handling K_FOREVER timeout correctly due to unsigned return value. Added explicit K_FOREVER handling of end time. Fixes #50611. Signed-off-by: Jay Shoen <jay.shoen@perceive.io>
This commit is contained in:
parent
c90b4a4e52
commit
b4734d5397
1 changed files with 3 additions and 0 deletions
|
@ -66,6 +66,9 @@ void *k_heap_aligned_alloc(struct k_heap *h, size_t align, size_t bytes,
|
|||
{
|
||||
int64_t now, end = sys_clock_timeout_end_calc(timeout);
|
||||
void *ret = NULL;
|
||||
|
||||
end = K_TIMEOUT_EQ(timeout, K_FOREVER) ? INT64_MAX : end;
|
||||
|
||||
k_spinlock_key_t key = k_spin_lock(&h->lock);
|
||||
|
||||
SYS_PORT_TRACING_OBJ_FUNC_ENTER(k_heap, aligned_alloc, h, timeout);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue