Skip to content

Commit

Permalink
schedule: fix address space mismatches
Browse files Browse the repository at this point in the history
Fix below sparse warnings:

zephyr_dp_schedule.c:134:20: warning: incorrect type in argument 1
(different address spaces)

zephyr_dp_schedule.c:348:36: warning: incorrect type in assignment
(different address spaces)

introduced by 3ee1d78

Signed-off-by: Chao Song <[email protected]>
  • Loading branch information
Chao Song authored and lgirdwood committed Mar 17, 2023
1 parent 8541d68 commit 34ea694
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/schedule/zephyr_dp_schedule.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ static int scheduler_dp_task_free(void *data, struct task *task)
scheduler_dp_unlock(lock_key);

/* free task stack */
rfree(pdata->p_stack);
rfree((__sparse_force void *)pdata->p_stack);

/* all other memory has been allocated as a single malloc, will be freed later by caller */
return 0;
Expand Down Expand Up @@ -276,7 +276,7 @@ int scheduler_dp_task_init(struct task **task,
size_t stack_size,
uint32_t task_priority)
{
void *p_stack = NULL;
void __sparse_cache *p_stack = NULL;

/* memory allocation helper structure */
struct {
Expand All @@ -301,17 +301,18 @@ int scheduler_dp_task_init(struct task **task,

/* allocate stack - must be aligned so a separate alloc */
stack_size = Z_KERNEL_STACK_SIZE_ADJUST(stack_size);
p_stack = rballoc_align(0, SOF_MEM_CAPS_RAM, stack_size, Z_KERNEL_STACK_OBJ_ALIGN);
p_stack = (__sparse_force void __sparse_cache *)
rballoc_align(0, SOF_MEM_CAPS_RAM, stack_size, Z_KERNEL_STACK_OBJ_ALIGN);
if (!p_stack) {
tr_err(&dp_tr, "zephyr_dp_task_init(): stack alloc failed");
ret = -ENOMEM;
goto err;
}

/* create a zephyr thread for the task */
thread_id = k_thread_create(&task_memory->thread, p_stack, stack_size, dp_thread_fn,
&task_memory->task, NULL, NULL, task_priority,
K_USER, K_FOREVER);
thread_id = k_thread_create(&task_memory->thread, (__sparse_force void *)p_stack,
stack_size, dp_thread_fn, &task_memory->task, NULL, NULL,
task_priority, K_USER, K_FOREVER);
if (!thread_id) {
ret = -EFAULT;
tr_err(&dp_tr, "zephyr_dp_task_init(): zephyr thread create failed");
Expand Down Expand Up @@ -356,7 +357,7 @@ int scheduler_dp_task_init(struct task **task,
/* cleanup - free all allocated resources */
if (thread_id)
k_thread_abort(thread_id);
rfree(p_stack);
rfree((__sparse_force void *)p_stack);
rfree(task_memory);
return ret;
}

0 comments on commit 34ea694

Please sign in to comment.