From: Richard Fitzgerald Date: Mon, 9 Mar 2026 11:56:51 +0000 (+0000) Subject: ASoC: cs35l56-test: Remove pointless duplicate loop counters X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=66f71ec3539e0e724f5099e6d4bbc81db4d9954a;p=thirdparty%2Flinux.git ASoC: cs35l56-test: Remove pointless duplicate loop counters 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 Link: https://patch.msgid.link/20260309115651.1090368-1-rf@opensource.cirrus.com Signed-off-by: Mark Brown --- diff --git a/sound/soc/codecs/cs35l56-test.c b/sound/soc/codecs/cs35l56-test.c index ac3f34bf8adc9..124fe5e755008 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));