mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ALSA: dummy: Move pcm_substreams check out of the loop
@ 2026-09-28  2:18 phucduc.bui
  2026-09-28 12:32 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: phucduc.bui @ 2026-09-28  2:18 UTC (permalink / raw)
  To: Jaroslav Kysela, Takashi Iwai
  Cc: thomas.weissschuh, Thomas Gleixner, HyeongJun An, Kees Cook,
	linux-sound, linux-kernel, bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

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.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
 sound/drivers/dummy.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/sound/drivers/dummy.c b/sound/drivers/dummy.c
index 3f6bfee29986..6b0a06e5c876 100644
--- a/sound/drivers/dummy.c
+++ b/sound/drivers/dummy.c
@@ -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;
-- 
2.43.0


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

* Re: [PATCH] ALSA: dummy: Move pcm_substreams check out of the loop
  2026-09-28  2:18 [PATCH] ALSA: dummy: Move pcm_substreams check out of the loop phucduc.bui
@ 2026-09-28 12:32 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2026-09-28 12:32 UTC (permalink / raw)
  To: phucduc.bui
  Cc: Jaroslav Kysela, Takashi Iwai, thomas.weissschuh,
	Thomas Gleixner, HyeongJun An, Kees Cook, linux-sound,
	linux-kernel

On Mon, 28 Sep 2026 04:18:23 +0200,
phucduc.bui@gmail.com wrote:
> 
> From: bui duc phuc <phucduc.bui@gmail.com>
> 
> 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.
> 
> Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>

Applied to for-next branch.  Thanks.


Takashi

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

end of thread, other threads:[~2026-09-28 12:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-28  2:18 [PATCH] ALSA: dummy: Move pcm_substreams check out of the loop phucduc.bui
2026-09-28 12:32 ` Takashi Iwai

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

all inboxes | Powered by JetHome®