Skip to content

Commit 4e3771a

Browse files
lyakhkv2019i
authored andcommitted
schedule: fix regression with DRAM execution debugging
Fix a NULL dereference when a __cold function is called before schedulers are initilised on that core and CONFIG_COLD_STORE_EXECUTE_DEBUG=y and assertions are enabled. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
1 parent 48cdc4d commit 4e3771a

3 files changed

Lines changed: 6 additions & 2 deletions

File tree

src/include/sof/schedule/schedule.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,9 @@ static inline void *scheduler_get_data(uint16_t type)
197197
struct schedule_data *sch;
198198
struct list_item *slist;
199199

200+
if (!schedulers)
201+
return NULL;
202+
200203
list_for_item(slist, &schedulers->list) {
201204
sch = container_of(slist, struct schedule_data, list);
202205
if (type == sch->type)

src/schedule/zephyr_domain.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,8 @@ struct ll_schedule_domain *zephyr_domain_init(int clk)
609609
/* Check if currently running in the LL scheduler thread context */
610610
bool ll_sch_is_current(void)
611611
{
612-
struct zephyr_domain *zephyr_domain = ll_sch_domain_get_pdata(zephyr_ll_domain());
612+
struct ll_schedule_domain *ll_dom = zephyr_ll_domain();
613+
struct zephyr_domain *zephyr_domain = ll_dom ? ll_sch_domain_get_pdata(ll_dom) : NULL;
613614

614615
if (!zephyr_domain)
615616
return false;

src/schedule/zephyr_ll.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,5 +770,5 @@ struct ll_schedule_domain *zephyr_ll_domain(void)
770770
{
771771
struct zephyr_ll *ll_sch = scheduler_get_data(SOF_SCHEDULE_LL_TIMER);
772772

773-
return ll_sch->ll_domain;
773+
return ll_sch ? ll_sch->ll_domain : NULL;
774774
}

0 commit comments

Comments
 (0)