Skip to content

Commit

Permalink
Klockwork fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Slawomir Blauciak <slawomir.blauciak@linux.intel.com>
  • Loading branch information
slawblauciak committed Aug 24, 2018
1 parent 3ecf438 commit 3093cf6
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 7 deletions.
16 changes: 15 additions & 1 deletion src/arch/xtensa/include/arch/task.h
Expand Up @@ -167,28 +167,42 @@ static inline void arch_run_task(struct task *task)
/**
* \brief Allocates IRQ tasks.
*/
static inline void arch_allocate_tasks(void)
static inline int arch_allocate_tasks(void)
{
/* irq low */
struct irq_task **low = task_irq_low_get();
*low = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, sizeof(**low));

if (!*low)
return -ENOMEM;

list_init(&((*low)->list));
spinlock_init(&((*low)->lock));
(*low)->irq = PLATFORM_IRQ_TASK_LOW;

/* irq medium */
struct irq_task **med = task_irq_med_get();
*med = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, sizeof(**med));

if (!*med)
return -ENOMEM;

list_init(&((*med)->list));
spinlock_init(&((*med)->lock));
(*med)->irq = PLATFORM_IRQ_TASK_MED;

/* irq high */
struct irq_task **high = task_irq_high_get();
*high = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, sizeof(**high));

if (!*high)
return -ENOMEM;

list_init(&((*high)->list));
spinlock_init(&((*high)->lock));
(*high)->irq = PLATFORM_IRQ_TASK_HIGH;

return 0;
}

/**
Expand Down
15 changes: 13 additions & 2 deletions src/audio/eq_fir.c
Expand Up @@ -345,12 +345,23 @@ static int fir_cmd_get_data(struct comp_dev *dev,
case SOF_CTRL_CMD_BINARY:
trace_eq("gbi");

struct sof_eq_fir_config *cfg =
(struct sof_eq_fir_config *)cdata->data->data;

/* Copy back to user space */
bs = cd->config->size;
bs = cfg->size;
if (bs > SOF_EQ_FIR_MAX_SIZE || bs < 1)
return -EINVAL;
if (!cd->config)
if (!cd->config) {
cd->config = rzalloc(RZONE_RUNTIME,
SOF_MEM_CAPS_RAM,
bs);

if (!cd->config)
return -ENOMEM;

memcpy(cdata->data->data, cd->config, bs);
}
break;
default:
trace_eq_error("egt");
Expand Down
4 changes: 2 additions & 2 deletions src/include/sof/task.h
Expand Up @@ -40,9 +40,9 @@ int do_task_master_core(struct sof *sof);

int do_task_slave_core(struct sof *sof);

static inline void allocate_tasks(void)
static inline int allocate_tasks(void)
{
arch_allocate_tasks();
return arch_allocate_tasks();
}

static inline void run_task(struct task *task)
Expand Down
8 changes: 6 additions & 2 deletions src/lib/schedule.c
Expand Up @@ -375,6 +375,10 @@ int scheduler_init(struct sof *sof)

struct schedule_data **sch = arch_schedule_get();
*sch = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, sizeof(**sch));

if (!*sch)
return -ENOMEM;

list_init(&((*sch)->list));
spinlock_init(&((*sch)->lock));
(*sch)->clock = PLATFORM_SCHED_CLOCK;
Expand All @@ -385,9 +389,9 @@ int scheduler_init(struct sof *sof)
interrupt_enable(PLATFORM_SCHEDULE_IRQ);

/* allocate arch tasks */
allocate_tasks();
int tasks_result = allocate_tasks();

return 0;
return tasks_result;
}

/* Frees scheduler */
Expand Down

0 comments on commit 3093cf6

Please sign in to comment.