Skip to contentSkip to conversation

ALSA: dummy: Move pcm_substreams check out of the loop

PATCH Applied [email protected] 2 participants 2 messages Sep 28 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: dummy: Move pcm_substreams check out of the loop

From: bui duc phuc <[email protected]>

The pcm_substreams[dev] range check does not depend on the loop index. Do it once before the loop instead of on every iteration.

No functional change.

---
 sound/drivers/dummy.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
sound/drivers/dummy.c +6 -4
index 3f6bfee29986..6b0a06e5c876 100644
@@ -1063,11 +1063,13 @@ static int snd_dummy_probe(struct platform_device *devptr)
 			break;
 		}
 	}
+
+	if (pcm_substreams[dev] < 1)
+		pcm_substreams[dev] = 1;
+	if (pcm_substreams[dev] > MAX_PCM_SUBSTREAMS)
+		pcm_substreams[dev] = MAX_PCM_SUBSTREAMS;
+
 	for (idx = 0; idx < MAX_PCM_DEVICES && idx < pcm_devs[dev]; idx++) {
-		if (pcm_substreams[dev] < 1)
-			pcm_substreams[dev] = 1;
-		if (pcm_substreams[dev] > MAX_PCM_SUBSTREAMS)
-			pcm_substreams[dev] = MAX_PCM_SUBSTREAMS;
 		err = snd_card_dummy_pcm(dummy, idx, pcm_substreams[dev]);
 		if (err < 0)
 			return err;
Signature · 1 line
2.43.0