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:
Erik Faye-Lund 2024-11-11 15:15:11 +01:00 committed by Marge Bot
parent e50f7fad86
commit b8bb9e08bc

View file

@ -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;