ALSA: hda/hdmi: Limit the maximal count of PCM devices to 8
authorJaroslav Kysela <perex@perex.cz>
Fri, 23 Sep 2022 08:22:36 +0000 (10:22 +0200)
committerTakashi Iwai <tiwai@suse.de>
Mon, 26 Sep 2022 06:23:05 +0000 (08:23 +0200)
The current hardware has up to 4 converters. Save little space.
The limit 8 is enough even for a more improved hardware.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20220923082236.61024-1-perex@perex.cz
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/patch_hdmi.c

index 1863836..c172640 100644 (file)
@@ -151,7 +151,7 @@ struct hdmi_spec {
         */
        int dev_num;
        struct snd_array pins; /* struct hdmi_spec_per_pin */
-       struct hdmi_pcm pcm_rec[16];
+       struct hdmi_pcm pcm_rec[8];
        struct mutex pcm_lock;
        struct mutex bind_lock; /* for audio component binding */
        /* pcm_bitmap means which pcms have been assigned to pins*/
@@ -2299,8 +2299,8 @@ static int generic_hdmi_build_pcms(struct hda_codec *codec)
                pstr = &info->stream[SNDRV_PCM_STREAM_PLAYBACK];
                pstr->substreams = 1;
                pstr->ops = generic_ops;
-               /* pcm number is less than 16 */
-               if (spec->pcm_used >= 16)
+               /* pcm number is less than pcm_rec array size */
+               if (spec->pcm_used >= ARRAY_SIZE(spec->pcm_rec))
                        break;
                /* other pstr fields are set in open */
        }