[PATCH] ASoC: cs35l56-test: Remove pointless duplicate loop counters

From: Richard Fitzgerald

Date: Mon Mar 09 2026 - 08:04:10 EST


In cs35l56_test_parse_xu_onchip_spkid() the first two loops used
local i to index an array and num_gpios/num_pulls to count how
many entries it had seen. But both i and num_* started at 0 and
incremented on each loop so were identical. Remove i from these
loops.

Signed-off-by: Richard Fitzgerald <rf@xxxxxxxxxxxxxxxxxxxxx>
---
sound/soc/codecs/cs35l56-test.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/sound/soc/codecs/cs35l56-test.c b/sound/soc/codecs/cs35l56-test.c
index ac3f34bf8adc..124fe5e75500 100644
--- a/sound/soc/codecs/cs35l56-test.c
+++ b/sound/soc/codecs/cs35l56-test.c
@@ -364,18 +364,17 @@ static void cs35l56_test_parse_xu_onchip_spkid(struct kunit *test)
struct cs35l56_test_priv *priv = test->priv;
struct cs35l56_private *cs35l56 = priv->cs35l56_priv;
struct software_node *ext0_node;
- int num_gpios = 0;
- int num_pulls = 0;
+ int num_gpios, num_pulls;
int i;

- for (i = 0; i < ARRAY_SIZE(param->spkid_gpios); i++, num_gpios++) {
- if (param->spkid_gpios[i] < 0)
+ for (num_gpios = 0; num_gpios < ARRAY_SIZE(param->spkid_gpios); num_gpios++) {
+ if (param->spkid_gpios[num_gpios] < 0)
break;
}
KUNIT_ASSERT_LE(test, num_gpios, ARRAY_SIZE(cs35l56->base.onchip_spkid_gpios));

- for (i = 0; i < ARRAY_SIZE(param->spkid_pulls); i++, num_pulls++) {
- if (param->spkid_pulls[i] < 0)
+ for (num_pulls = 0; num_pulls < ARRAY_SIZE(param->spkid_pulls); num_pulls++) {
+ if (param->spkid_pulls[num_pulls] < 0)
break;
}
KUNIT_ASSERT_LE(test, num_pulls, ARRAY_SIZE(cs35l56->base.onchip_spkid_pulls));
--
2.47.3