From 508506a80c22329fdfc98328097d9b599ea0976f Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 16 Apr 2021 14:48:08 +0200 Subject: [PATCH] ucm: fixed find-device substitution (non-continuous PCM devices) The PCM device numbers may be non-continous. Skip them when -ENOENT error is returned. Signed-off-by: Jaroslav Kysela --- src/ucm/ucm_subs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ucm/ucm_subs.c b/src/ucm/ucm_subs.c index b9fee72e..c56730c5 100644 --- a/src/ucm/ucm_subs.c +++ b/src/ucm/ucm_subs.c @@ -380,12 +380,15 @@ static struct lookup_iterate *rval_pcm_lookup1(struct lookup_iterate *iter, snd_ctl_t *ctl = iter->ctl_list->ctl; int err; +next: if (snd_ctl_pcm_next_device(ctl, &device) < 0 || device < 0) return NULL; pcminfo = iter->info; snd_pcm_info_set_device(pcminfo, device); err = snd_ctl_pcm_info(ctl, pcminfo); if (err < 0) { + if (err == -ENOENT) + goto next; uc_error("Unable to obtain PCM info (device %d)", device); return NULL; }