]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ASoC: cs35l56-test: Remove pointless duplicate loop counters
authorRichard Fitzgerald <rf@opensource.cirrus.com>
Mon, 9 Mar 2026 11:56:51 +0000 (11:56 +0000)
committerMark Brown <broonie@kernel.org>
Mon, 9 Mar 2026 13:44:35 +0000 (13:44 +0000)
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@opensource.cirrus.com>
Link: https://patch.msgid.link/20260309115651.1090368-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/cs35l56-test.c

index ac3f34bf8adc93d2bc2d401c7b5a5cfc11c25e54..124fe5e75500814b88c0f9241eabb7315e05712a 100644 (file)
@@ -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));