Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Richard Fitzgerald <rf@opensource.cirrus.com>
To: broonie@kernel.org
Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
	patches@opensource.cirrus.com
Subject: [PATCH] ASoC: cs35l56-test: Remove pointless duplicate loop counters
Date: Mon,  9 Mar 2026 11:56:51 +0000	[thread overview]
Message-ID: <20260309115651.1090368-1-rf@opensource.cirrus.com> (raw)

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


             reply	other threads:[~2026-03-09 11:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-09 11:56 Richard Fitzgerald [this message]
2026-03-09 19:45 ` [PATCH] ASoC: cs35l56-test: Remove pointless duplicate loop counters Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260309115651.1090368-1-rf@opensource.cirrus.com \
    --to=rf@opensource.cirrus.com \
    --cc=broonie@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=patches@opensource.cirrus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox