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:
Jay Shoen 2022-09-28 17:59:45 -06:00 committed by Mahesh Mahadevan
commit b4734d5397

View file

@ -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);