Linux Sound subsystem development
 help / color / mirror / Atom feed
* [PATCH] ASoC: cs35l56-test: Remove pointless duplicate loop counters
@ 2026-03-09 11:56 Richard Fitzgerald
  2026-03-09 19:45 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Fitzgerald @ 2026-03-09 11:56 UTC (permalink / raw)
  To: broonie; +Cc: linux-sound, linux-kernel, patches

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>
---
 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-03-09 19:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-09 11:56 [PATCH] ASoC: cs35l56-test: Remove pointless duplicate loop counters Richard Fitzgerald
2026-03-09 19:45 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox