Skip to content

Commit 3093cf6

Browse files
committed
Klockwork fixes
Signed-off-by: Slawomir Blauciak <[email protected]>
1 parent 3ecf438 commit 3093cf6

File tree

4 files changed

+36
-7
lines changed

4 files changed

+36
-7
lines changed

src/arch/xtensa/include/arch/task.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,28 +167,42 @@ static inline void arch_run_task(struct task *task)
167167
/**
168168
* \brief Allocates IRQ tasks.
169169
*/
170-
static inline void arch_allocate_tasks(void)
170+
static inline int arch_allocate_tasks(void)
171171
{
172172
/* irq low */
173173
struct irq_task **low = task_irq_low_get();
174174
*low = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, sizeof(**low));
175+
176+
if (!*low)
177+
return -ENOMEM;
178+
175179
list_init(&((*low)->list));
176180
spinlock_init(&((*low)->lock));
177181
(*low)->irq = PLATFORM_IRQ_TASK_LOW;
178182

179183
/* irq medium */
180184
struct irq_task **med = task_irq_med_get();
181185
*med = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, sizeof(**med));
186+
187+
if (!*med)
188+
return -ENOMEM;
189+
182190
list_init(&((*med)->list));
183191
spinlock_init(&((*med)->lock));
184192
(*med)->irq = PLATFORM_IRQ_TASK_MED;
185193

186194
/* irq high */
187195
struct irq_task **high = task_irq_high_get();
188196
*high = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, sizeof(**high));
197+
198+
if (!*high)
199+
return -ENOMEM;
200+
189201
list_init(&((*high)->list));
190202
spinlock_init(&((*high)->lock));
191203
(*high)->irq = PLATFORM_IRQ_TASK_HIGH;
204+
205+
return 0;
192206
}
193207

194208
/**

src/audio/eq_fir.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,12 +345,23 @@ static int fir_cmd_get_data(struct comp_dev *dev,
345345
case SOF_CTRL_CMD_BINARY:
346346
trace_eq("gbi");
347347

348+
struct sof_eq_fir_config *cfg =
349+
(struct sof_eq_fir_config *)cdata->data->data;
350+
348351
/* Copy back to user space */
349-
bs = cd->config->size;
352+
bs = cfg->size;
350353
if (bs > SOF_EQ_FIR_MAX_SIZE || bs < 1)
351354
return -EINVAL;
352-
if (!cd->config)
355+
if (!cd->config) {
356+
cd->config = rzalloc(RZONE_RUNTIME,
357+
SOF_MEM_CAPS_RAM,
358+
bs);
359+
360+
if (!cd->config)
361+
return -ENOMEM;
362+
353363
memcpy(cdata->data->data, cd->config, bs);
364+
}
354365
break;
355366
default:
356367
trace_eq_error("egt");

src/include/sof/task.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ int do_task_master_core(struct sof *sof);
4040

4141
int do_task_slave_core(struct sof *sof);
4242

43-
static inline void allocate_tasks(void)
43+
static inline int allocate_tasks(void)
4444
{
45-
arch_allocate_tasks();
45+
return arch_allocate_tasks();
4646
}
4747

4848
static inline void run_task(struct task *task)

src/lib/schedule.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,10 @@ int scheduler_init(struct sof *sof)
375375

376376
struct schedule_data **sch = arch_schedule_get();
377377
*sch = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, sizeof(**sch));
378+
379+
if (!*sch)
380+
return -ENOMEM;
381+
378382
list_init(&((*sch)->list));
379383
spinlock_init(&((*sch)->lock));
380384
(*sch)->clock = PLATFORM_SCHED_CLOCK;
@@ -385,9 +389,9 @@ int scheduler_init(struct sof *sof)
385389
interrupt_enable(PLATFORM_SCHEDULE_IRQ);
386390

387391
/* allocate arch tasks */
388-
allocate_tasks();
392+
int tasks_result = allocate_tasks();
389393

390-
return 0;
394+
return tasks_result;
391395
}
392396

393397
/* Frees scheduler */

0 commit comments

Comments
 (0)