[PATCH] ASoC: cs35l56-test: Remove pointless duplicate loop counters

Richard Fitzgerald posted 1 patch 1 month ago
sound/soc/codecs/cs35l56-test.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
[PATCH] ASoC: cs35l56-test: Remove pointless duplicate loop counters
Posted by Richard Fitzgerald 1 month ago
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
Re: [PATCH] ASoC: cs35l56-test: Remove pointless duplicate loop counters
Posted by Mark Brown 1 month ago
On Mon, 09 Mar 2026 11:56:51 +0000, Richard Fitzgerald wrote:
> 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.
> 
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: cs35l56-test: Remove pointless duplicate loop counters
      commit: 66f71ec3539e0e724f5099e6d4bbc81db4d9954a

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark