lib: sbi: pmu: Improve loop in pmu_ctr_find_hw

We do not need to iterate over all values in the loop,
we can break the loop when we found a valid counter
that is not started yet.

Signed-off-by: Manuel Hernández Méndez <maherme.dev@gmail.com>
Link: https://lore.kernel.org/r/20250721160712.8766-1-maherme.dev@gmail.com
Signed-off-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
Manuel Hernández Méndez
2025-07-21 18:07:12 +02:00
committed by Anup Patel
parent 84044ee83c
commit 3204d74486

View File

@@ -780,6 +780,7 @@ static int pmu_ctr_find_hw(struct sbi_pmu_hart_state *phs,
continue; continue;
/* We found a valid counter that is not started yet */ /* We found a valid counter that is not started yet */
ctr_idx = cbase; ctr_idx = cbase;
break;
} }
} }