mirror of https://github.com/thesofproject/sof.git
scheduler: guard against subdivision underflow on domain clear
In some situations the domain clear routine might encounter a case, when the number of clients is decremented and 0, as such, a subsequent subdivision will result in an integer underflow. Signed-off-by: Slawomir Blauciak <slawomir.blauciak@linux.intel.com>
This commit is contained in:
parent
c9f442ba6b
commit
b500999477
|
@ -331,9 +331,11 @@ static void schedule_ll_domain_clear(struct ll_schedule_data *sch,
|
||||||
if (count == 1) {
|
if (count == 1) {
|
||||||
sch->domain->registered[cpu_get_id()] = false;
|
sch->domain->registered[cpu_get_id()] = false;
|
||||||
|
|
||||||
count = atomic_sub(&sch->domain->num_clients, 1);
|
if (atomic_read(&sch->domain->num_clients)) {
|
||||||
if (count == 1)
|
count = atomic_sub(&sch->domain->num_clients, 1);
|
||||||
domain_clear(sch->domain);
|
if (count == 1)
|
||||||
|
domain_clear(sch->domain);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tr_info(&ll_tr, "num_tasks %d total_num_tasks %d",
|
tr_info(&ll_tr, "num_tasks %d total_num_tasks %d",
|
||||||
|
|
Loading…
Reference in New Issue