Skip to content

Commit 34ea694

Browse files
Chao Songlgirdwood
authored andcommitted
schedule: fix address space mismatches
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 <chao.song@linux.intel.com>
1 parent 8541d68 commit 34ea694

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/schedule/zephyr_dp_schedule.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ static int scheduler_dp_task_free(void *data, struct task *task)
131131
scheduler_dp_unlock(lock_key);
132132

133133
/* free task stack */
134-
rfree(pdata->p_stack);
134+
rfree((__sparse_force void *)pdata->p_stack);
135135

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

281281
/* memory allocation helper structure */
282282
struct {
@@ -301,17 +301,18 @@ int scheduler_dp_task_init(struct task **task,
301301

302302
/* allocate stack - must be aligned so a separate alloc */
303303
stack_size = Z_KERNEL_STACK_SIZE_ADJUST(stack_size);
304-
p_stack = rballoc_align(0, SOF_MEM_CAPS_RAM, stack_size, Z_KERNEL_STACK_OBJ_ALIGN);
304+
p_stack = (__sparse_force void __sparse_cache *)
305+
rballoc_align(0, SOF_MEM_CAPS_RAM, stack_size, Z_KERNEL_STACK_OBJ_ALIGN);
305306
if (!p_stack) {
306307
tr_err(&dp_tr, "zephyr_dp_task_init(): stack alloc failed");
307308
ret = -ENOMEM;
308309
goto err;
309310
}
310311

311312
/* create a zephyr thread for the task */
312-
thread_id = k_thread_create(&task_memory->thread, p_stack, stack_size, dp_thread_fn,
313-
&task_memory->task, NULL, NULL, task_priority,
314-
K_USER, K_FOREVER);
313+
thread_id = k_thread_create(&task_memory->thread, (__sparse_force void *)p_stack,
314+
stack_size, dp_thread_fn, &task_memory->task, NULL, NULL,
315+
task_priority, K_USER, K_FOREVER);
315316
if (!thread_id) {
316317
ret = -EFAULT;
317318
tr_err(&dp_tr, "zephyr_dp_task_init(): zephyr thread create failed");
@@ -356,7 +357,7 @@ int scheduler_dp_task_init(struct task **task,
356357
/* cleanup - free all allocated resources */
357358
if (thread_id)
358359
k_thread_abort(thread_id);
359-
rfree(p_stack);
360+
rfree((__sparse_force void *)p_stack);
360361
rfree(task_memory);
361362
return ret;
362363
}

0 commit comments

Comments
 (0)