mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-03-07 03:20:28 +01:00
lima: add assert to validate list-lenght
If this could be zero, we'd end up with divisions by zero here, which uh... would be bad? I don't think that can happen, so let's assert about this, to make it clear what's going on. CID: 1444660 Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32381>
This commit is contained in:
parent
e50f7fad86
commit
b8bb9e08bc
1 changed files with 3 additions and 1 deletions
|
|
@ -54,7 +54,9 @@ static void schedule_calc_sched_info(gpir_node *node)
|
|||
if (node->rsched.est < est)
|
||||
node->rsched.est = est;
|
||||
|
||||
float reg_weight = 1.0f - 1.0f / list_length(&pred->succ_list);
|
||||
unsigned len = list_length(&pred->succ_list);
|
||||
assert(len > 0);
|
||||
float reg_weight = 1.0f - 1.0f / len;
|
||||
if (extra_reg > reg_weight)
|
||||
extra_reg = reg_weight;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue