Skip to content

Commit 66f71ec

Browse files
rfvirgilbroonie
authored andcommitted
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 <rf@opensource.cirrus.com> Link: https://patch.msgid.link/20260309115651.1090368-1-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent a2614f2 commit 66f71ec

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

sound/soc/codecs/cs35l56-test.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -364,18 +364,17 @@ static void cs35l56_test_parse_xu_onchip_spkid(struct kunit *test)
364364
struct cs35l56_test_priv *priv = test->priv;
365365
struct cs35l56_private *cs35l56 = priv->cs35l56_priv;
366366
struct software_node *ext0_node;
367-
int num_gpios = 0;
368-
int num_pulls = 0;
367+
int num_gpios, num_pulls;
369368
int i;
370369

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

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

0 commit comments

Comments
 (0)