Commit b4734d53 authored by Jay Shoen's avatar Jay Shoen Committed by Mahesh Mahadevan
Browse files

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: default avatarJay Shoen <jay.shoen@perceive.io>
parent c90b4a4e
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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);